File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 57
57
sideWidth: float = (60 * scaling)
58
58
luminance: float = if compIsMain: 0.55 else : 0.45
59
59
alpha: uint8 = if compIsMain: 255 else : 128
60
- # Color schemes
60
+ # A couple of hard-coded color schemes (2-5 components) which look nice
61
61
colorSchemeOKlab2c: seq [seq [float ]] = @ [
62
62
@ [luminance, 0.250 * scaleChroma, 0.000 ],
63
63
@ [luminance, - 0.250 * scaleChroma, 0.000 ]]
@@ -83,14 +83,23 @@ const
83
83
@ [0.400 , 0.217 * scaleChroma, 0.125 * scaleChroma],
84
84
@ [1.0 , 0.0 , 0.0 ]]
85
85
86
+
87
+
86
88
# *** Color Schemes ***
87
89
const colorSchemeOKlab: seq [seq [float ]] = static :
90
+ func colorSchemeOKlabNc(n: int ): seq [seq [float ]] =
91
+ for i in 0 ..< n:
92
+ let
93
+ angle = 2 * PI * i.float / n.float
94
+ a = 0.250 * scaleChroma * cos(angle)
95
+ b = 0.250 * scaleChroma * sin(angle)
96
+ result .add(@ [luminance, a, b])
88
97
case elementalEmbeddingLen:
89
98
of 2 : colorSchemeOKlab2c
90
99
of 3 : colorSchemeOKlab3c
91
100
of 4 : colorSchemeOKlab4c
92
101
of 5 : colorSchemeOKlab5c
93
- else : raise newException(ValueError, " Unsupported number of components " )
102
+ else : colorSchemeOKlabNc(elementalEmbeddingLen )
94
103
95
104
const propertyColoringOKlab: seq [seq [float ]] = static :
96
105
case propetyColoringStyle:
You can’t perform that action at this time.
0 commit comments