Simple Distrubution
This example_colors_file was generated by the following.
#!/usr/bin/env python
def mkgradient(start,finish):
nstart = mkcolor(*start)
nfinish = mkcolor(*finish)
return f"""gradientStart={nstart}
gradientEnd={nfinish}"""
def mkcolor(r,g,b):
n = 2 # flag telling that new format is being used, namely 0x2RRGGBB
n <<= 8
n += r
n <<= 8
n += g
n <<= 8
n += b
return n
custcolors = []
def addcolor(r,g,b):
n = mkcolor(r,g,b)
custcolors.append(n)
a = addcolor
a( 0xff, 0, 0 )
a( 0xff, 0xff, 0 )
a( 0, 0xff, 0 )
a( 0, 0xff, 0xff )
a( 0, 0, 0xff )
a( 0xff, 0, 0xff )
a( 0xff, 0xff, 0x7f )
a( 0x7f, 0xff, 0xff )
a( 0xff, 0x7f, 0xff )
a( 0xff, 0x7f, 0 )
a( 0, 0xff, 0x7f )
a( 0x7f, 0, 0xff )
a( 0xff, 0, 0x7f )
a( 0x7f, 0xff, 0 )
a( 0, 0x7f, 0xff )
a( 0x40, 0x80, 0xc0 )
lines = ["[SWS Color]"]
for i,x in enumerate(custcolors,1):
lines.append(f"custcolor{i}={x}")
gradientStart = (0x40,0x40,0xff)
gradientEnd = (0x7f,0,0x7f)
lines.append(mkgradient(gradientStart,gradientEnd))
import sys
args = sys.argv[1:]
if len(args) == 0:
print("\n".join(lines))
else:
with open(args[0],"wt") as f:
print("\n".join(lines),file=f)
Color File Format
The custcolor1=50266112 take the format custcolorN=X where X is the integer
representation of 0x2RRGGBB where RRGGBB are as in the CSS colour #RRGGBB.
The 2 indicates format version.
[SWS Color]
custcolor1=50266112
custcolor2=50331392
custcolor3=33619712
custcolor4=33619967
custcolor5=33554687
custcolor6=50266367
custcolor7=50331519
custcolor8=41943039
custcolor9=50298879
custcolor10=50298624
custcolor11=33619839
custcolor12=41877759
custcolor13=50266239
custcolor14=41942784
custcolor15=33587199
custcolor16=37781696
gradientStart=37765375
gradientEnd=41877631