 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 26.03.2026 14:38, jr wrote:
> well, I don't "speak" Python, so cannot do so either.
Well, initially my pythonic part consisted of three things:
1) One "with open..." for file handling.
2) One "for" loop for dictionary iterating.
3) One file .write with f-string, combining dictionary keys and values
with POV-Ray syntax elements.
All the rest of the file consisted of 147 dictionary entries, whose keys
and values were directly copied from W3C site.
Main reasons for doing all this with Python were:
1) I'm too lazy to think of search and replace sequence for transforming
W3C source into POV-Ray, "let the iron mechanism work";
2) Now it's extremely easy to change things en masse by, say, editing
that single f-string.
But now I tried to address all the issues mentioned in both replies, so
my pythonic code like quadrupled in size ;-)
Here go the updated version (and exported .inc example for those who
loathe to touch Python). Note that file name to be inserted here and
there in all these "include_temp" is defined within program, so it's
easy to edit it with notepad - all the "doing" code goes after
dictionary definition, which, considering code and dictionary relative
sizes, means "at the very end of Python file".
--
Ilyich the Toad
https://dnyarri.github.io/
Post a reply to this message
Attachments:
Download 'svg_recognized_color_keyword_names.py.txt' (7 KB)
Download 'svg_colors.inc.txt' (8 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
That's the second time TODAY that I've seen the word "idempotent".
Spooky. But an excellent goal to set for all code.
Also applicable to the keyword project I was discussing, with regard to
self-documenting.
As Richard stated:
"Note that the `srgb` keyword will yield consistent colors
regardless of your assumed_gamma setting."
So, if we are using assumed_gamma 1.0 for all scenes, then why are we even using
rgb? If everything is implemented from here forward using srgb, then
everything should be good, right? N^1 = N.
Now, I often have to do experimentation where I modify colors from rgb to rgbf
to rgbt to maybe rgbft, and that gets to be a pain to go back and rewrite all
the keywords and color vectors.
Having worked out a fairly robust system for handling vector arity, I'm
considering just making some kind of all-purpose color macro, that detects the
size of the color vector and emits the appropriate keyword.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
hi,
Ilya Razmanov <ily### [at] gmail com> wrote:
> On 26.03.2026 14:38, jr wrote:
> > well, I don't "speak" Python, so cannot do so either.
> Well, initially my pythonic part consisted of three things:
> ...
> But now I tried to address all the issues mentioned in both replies, so
> my pythonic code like quadrupled in size ;-)
>
> Here go the updated version (and exported .inc example ...
super. one small oversight (sorry :-)), all '#debug' statements need an
explicit '\n' to "show".
regards, jr.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2026-03-25 18:02 (-4), Cousin Ricky wrote:
> Ilya Razmanov <ily### [at] gmail com> wrote:
>> [snip]
>>
>> Resulting .inc file attached in case someone need these named colors.
>>
>> Python file attached as well in case someone wish to change something in
>> output format, like rounding (currently set to 3 decimals) etc.
>
> I'm pretty sure that, as the W3C has adopted sRGB as its standard, your colors
> should be #declared with `srgb` rather than `rgb`. Your list is consistent with
> mine, and when I render these colors, it seems clear that they are gamma-2.2 or
> sRGB encoded. Note that the `srgb` keyword will yield consistent colors
> regardless of your assumed_gamma setting.
Verified: https://www.w3.org/TR/SVG11/types.html#DataTypeColor
You should use the `srgb` keyword, not the `rgb` keyword.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 26.03.2026 16:32, jr wrote:
> super. one small oversight (sorry :-)), all '#debug' statements need an
> explicit '\n' to "show".
LOL, I was so concentrated on adding "\n" to the ends of my strings that
completely missed adding "\\n" in the middle.
Anyway, here go finally corrected script, so anyone may change things to
one's own taste.
--
Ilyich the Toad
https://dnyarri.github.io/
Post a reply to this message
Attachments:
Download 'svg_recognized_color_keyword_names.py.txt' (7 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 25/03/2026 23:02, Cousin Ricky wrote:
> ...
> Thanks for this. I toyed around with this idea a few years ago, but I got the
> sense that the list of colors varied from distro to distro, so I put it on
> indefinite hold. Looking at your source, I wonder if the inconsistencies may
> have been because I was looking at X11 rather than SVG.
>
X11 ?
From <https://en.wikipedia.org/wiki/X11_color_names> and a few formulas
in Excel :
#declare AliceBlue = color red 0.94 green 0.97 blue 1.00;
#declare AntiqueWhite = color red 0.98 green 0.92 blue 0.84;
#declare Aqua = color red 0.00 green 1.00 blue 1.00;
#declare Aquamarine = color red 0.50 green 1.00 blue 0.83;
#declare Azure = color red 0.94 green 1.00 blue 1.00;
#declare Beige = color red 0.96 green 0.96 blue 0.86;
#declare Bisque = color red 1.00 green 0.89 blue 0.77;
#declare Black = color red 0.00 green 0.00 blue 0.00;
#declare BlanchedAlmond = color red 1.00 green 0.92 blue 0.80;
#declare Blue = color red 0.00 green 0.00 blue 1.00;
#declare BlueViolet = color red 0.54 green 0.17 blue 0.89;
#declare Brown = color red 0.65 green 0.16 blue 0.16;
#declare Burlywood = color red 0.87 green 0.72 blue 0.53;
#declare CadetBlue = color red 0.37 green 0.62 blue 0.63;
#declare Chartreuse = color red 0.50 green 1.00 blue 0.00;
#declare Chocolate = color red 0.82 green 0.41 blue 0.12;
#declare Coral = color red 1.00 green 0.50 blue 0.31;
#declare CornflowerBlue = color red 0.39 green 0.58 blue 0.93;
#declare Cornsilk = color red 1.00 green 0.97 blue 0.86;
#declare Crimson = color red 0.86 green 0.08 blue 0.24;
#declare Cyan = color red 0.00 green 1.00 blue 1.00;
#declare DarkBlue = color red 0.00 green 0.00 blue 0.55;
#declare DarkCyan = color red 0.00 green 0.55 blue 0.55;
#declare DarkGoldenrod = color red 0.72 green 0.53 blue 0.04;
#declare DarkGray = color red 0.66 green 0.66 blue 0.66;
#declare DarkGreen = color red 0.00 green 0.39 blue 0.00;
#declare DarkKhaki = color red 0.74 green 0.72 blue 0.42;
#declare DarkMagenta = color red 0.55 green 0.00 blue 0.55;
#declare DarkOliveGreen = color red 0.33 green 0.42 blue 0.18;
#declare DarkOrange = color red 1.00 green 0.55 blue 0.00;
#declare DarkOrchid = color red 0.60 green 0.20 blue 0.80;
#declare DarkRed = color red 0.55 green 0.00 blue 0.00;
#declare DarkSalmon = color red 0.91 green 0.59 blue 0.48;
#declare DarkSeaGreen = color red 0.56 green 0.74 blue 0.56;
#declare DarkSlateBlue = color red 0.28 green 0.24 blue 0.55;
#declare DarkSlateGray = color red 0.18 green 0.31 blue 0.31;
#declare DarkTurquoise = color red 0.00 green 0.81 blue 0.82;
#declare DarkViolet = color red 0.58 green 0.00 blue 0.83;
#declare DeepPink = color red 1.00 green 0.08 blue 0.58;
#declare DeepSkyBlue = color red 0.00 green 0.75 blue 1.00;
#declare DimGray = color red 0.41 green 0.41 blue 0.41;
#declare DodgerBlue = color red 0.12 green 0.56 blue 1.00;
#declare Firebrick = color red 0.70 green 0.13 blue 0.13;
#declare FloralWhite = color red 1.00 green 0.98 blue 0.94;
#declare ForestGreen = color red 0.13 green 0.55 blue 0.13;
#declare Fuchsia = color red 1.00 green 0.00 blue 1.00;
#declare Gainsboro[a] = color red 0.86 green 0.86 blue 0.86;
#declare GhostWhite = color red 0.97 green 0.97 blue 1.00;
#declare Gold = color red 1.00 green 0.84 blue 0.00;
#declare Goldenrod = color red 0.85 green 0.65 blue 0.13;
#declare Gray = color red 0.75 green 0.75 blue 0.75;
#declare WebGray = color red 0.50 green 0.50 blue 0.50;
#declare Green = color red 0.00 green 1.00 blue 0.00;
#declare WebGreen = color red 0.00 green 0.50 blue 0.00;
#declare GreenYellow = color red 0.68 green 1.00 blue 0.18;
#declare Honeydew = color red 0.94 green 1.00 blue 0.94;
#declare HotPink = color red 1.00 green 0.41 blue 0.71;
#declare IndianRed = color red 0.80 green 0.36 blue 0.36;
#declare Indigo = color red 0.29 green 0.00 blue 0.51;
#declare Ivory = color red 1.00 green 1.00 blue 0.94;
#declare Khaki = color red 0.94 green 0.90 blue 0.55;
#declare Lavender = color red 0.90 green 0.90 blue 0.98;
#declare LavenderBlush = color red 1.00 green 0.94 blue 0.96;
#declare LawnGreen = color red 0.49 green 0.99 blue 0.00;
#declare LemonChiffon = color red 1.00 green 0.98 blue 0.80;
#declare LightBlue = color red 0.68 green 0.85 blue 0.90;
#declare LightCoral = color red 0.94 green 0.50 blue 0.50;
#declare LightCyan = color red 0.88 green 1.00 blue 1.00;
#declare LightGoldenrod = color red 0.98 green 0.98 blue 0.82;
#declare LightGray = color red 0.83 green 0.83 blue 0.83;
#declare LightGreen = color red 0.56 green 0.93 blue 0.56;
#declare LightPink = color red 1.00 green 0.71 blue 0.76;
#declare LightSalmon = color red 1.00 green 0.63 blue 0.48;
#declare LightSeaGreen = color red 0.13 green 0.70 blue 0.67;
#declare LightSkyBlue = color red 0.53 green 0.81 blue 0.98;
#declare LightSlateGray = color red 0.47 green 0.53 blue 0.60;
#declare LightSteelBlue = color red 0.69 green 0.77 blue 0.87;
#declare LightYellow = color red 1.00 green 1.00 blue 0.88;
#declare Lime = color red 0.00 green 1.00 blue 0.00;
#declare LimeGreen = color red 0.20 green 0.80 blue 0.20;
#declare Linen = color red 0.98 green 0.94 blue 0.90;
#declare Magenta = color red 1.00 green 0.00 blue 1.00;
#declare Maroon = color red 0.69 green 0.19 blue 0.38;
#declare WebMaroon = color red 0.50 green 0.00 blue 0.00;
#declare MediumAquamarine = color red 0.40 green 0.80 blue 0.67;
#declare MediumBlue = color red 0.00 green 0.00 blue 0.80;
#declare MediumOrchid = color red 0.73 green 0.33 blue 0.83;
#declare MediumPurple = color red 0.58 green 0.44 blue 0.86;
#declare MediumSeaGreen = color red 0.24 green 0.70 blue 0.44;
#declare MediumSlateBlue = color red 0.48 green 0.41 blue 0.93;
#declare MediumSpringGreen = color red 0.00 green 0.98 blue 0.60;
#declare MediumTurquoise = color red 0.28 green 0.82 blue 0.80;
#declare MediumVioletRed = color red 0.78 green 0.08 blue 0.52;
#declare MidnightBlue = color red 0.10 green 0.10 blue 0.44;
#declare MintCream = color red 0.96 green 1.00 blue 0.98;
#declare MistyRose = color red 1.00 green 0.89 blue 0.88;
#declare Moccasin = color red 1.00 green 0.89 blue 0.71;
#declare NavajoWhite = color red 1.00 green 0.87 blue 0.68;
#declare NavyBlue = color red 0.00 green 0.00 blue 0.50;
#declare OldLace = color red 0.99 green 0.96 blue 0.90;
#declare Olive = color red 0.50 green 0.50 blue 0.00;
#declare OliveDrab = color red 0.42 green 0.56 blue 0.14;
#declare Orange = color red 1.00 green 0.65 blue 0.00;
#declare OrangeRed = color red 1.00 green 0.27 blue 0.00;
#declare Orchid = color red 0.85 green 0.44 blue 0.84;
#declare PaleGoldenrod = color red 0.93 green 0.91 blue 0.67;
#declare PaleGreen = color red 0.60 green 0.98 blue 0.60;
#declare PaleTurquoise = color red 0.69 green 0.93 blue 0.93;
#declare PaleVioletRed = color red 0.86 green 0.44 blue 0.58;
#declare PapayaWhip = color red 1.00 green 0.94 blue 0.84;
#declare PeachPuff = color red 1.00 green 0.85 blue 0.73;
#declare Peru = color red 0.80 green 0.52 blue 0.25;
#declare Pink = color red 1.00 green 0.75 blue 0.80;
#declare Plum = color red 0.87 green 0.63 blue 0.87;
#declare PowderBlue = color red 0.69 green 0.88 blue 0.90;
#declare Purple = color red 0.63 green 0.13 blue 0.94;
#declare WebPurple = color red 0.50 green 0.00 blue 0.50;
#declare RebeccaPurple = color red 0.40 green 0.20 blue 0.60;
#declare Red = color red 1.00 green 0.00 blue 0.00;
#declare RosyBrown = color red 0.74 green 0.56 blue 0.56;
#declare RoyalBlue = color red 0.25 green 0.41 blue 0.88;
#declare Saddlebrown = color red 0.55 green 0.27 blue 0.07;
#declare Salmon = color red 0.98 green 0.50 blue 0.45;
#declare SandyBrown = color red 0.96 green 0.64 blue 0.38;
#declare SeaGreen = color red 0.18 green 0.55 blue 0.34;
#declare Seashell = color red 1.00 green 0.96 blue 0.93;
#declare Sienna = color red 0.63 green 0.32 blue 0.18;
#declare Silver = color red 0.75 green 0.75 blue 0.75;
#declare SkyBlue = color red 0.53 green 0.81 blue 0.92;
#declare SlateBlue = color red 0.42 green 0.35 blue 0.80;
#declare SlateGray = color red 0.44 green 0.50 blue 0.56;
#declare Snow = color red 1.00 green 0.98 blue 0.98;
#declare SpringGreen = color red 0.00 green 1.00 blue 0.50;
#declare SteelBlue = color red 0.27 green 0.51 blue 0.71;
#declare Tan = color red 0.82 green 0.71 blue 0.55;
#declare Teal = color red 0.00 green 0.50 blue 0.50;
#declare Thistle = color red 0.85 green 0.75 blue 0.85;
#declare Tomato = color red 1.00 green 0.39 blue 0.28;
#declare Turquoise = color red 0.25 green 0.88 blue 0.82;
#declare Violet = color red 0.93 green 0.51 blue 0.93;
#declare Wheat = color red 0.96 green 0.87 blue 0.70;
#declare White = color red 1.00 green 1.00 blue 1.00;
#declare WhiteSmoke = color red 0.96 green 0.96 blue 0.96;
#declare Yellow = color red 1.00 green 1.00 blue 0.00;
#declare YellowGreen = color red 0.60 green 0.80 blue 0.20;
ps : spaces in color names have been removed
--
kurtz le pirate
compagnie de la banquise
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
hi,
kurtz le pirate <kur### [at] free fr> wrote:
> On 25/03/2026 23:02, Cousin Ricky wrote:
> > ...
> > Thanks for this. I toyed around with this idea a few years ago, but I got the
> > sense that the list of colors varied from distro to distro, so I put it on
> > indefinite hold. Looking at your source, I wonder if the inconsistencies may
> > have been because I was looking at X11 rather than SVG.
>
> X11 ?
>
> From <https://en.wikipedia.org/wiki/X11_color_names> ...
really ?? why not use the "authoritative" source, '/usr/share/X11/rgb.txt' ?
and you get well over 500 colour names and variations (594 here).
regards, jr.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 28/03/2026 11:32, jr wrote:
>
> really ?? why not use the "authoritative" source, '/usr/share/X11/rgb.txt' ?
> and you get well over 500 colour names and variations (594 here).
>
>
Shame on me :(
Here, the new one from /usr/share/X11/rgb.txt
--
kurtz le pirate
compagnie de la banquise
Post a reply to this message
Attachments:
Download 'x11_colors.inc.txt' (52 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
hi,
kurtz le pirate <kur### [at] free fr> wrote:
> On 28/03/2026 11:32, jr wrote:
> > really ?? ...
> Shame on me :(
(I started blaming my age :-))
regards, jr.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
This reminds me of some similar "named color" projects in the past.
Suggestion:
You output your converted colors as identifier declarations:
#declare Aliceblue = srgb <0.941, 0.973, 1.0>;
However, these are less meaningful and useful from the standpoint of SDL, since
you smoosh everything together. This is the current problem that we have with
the parser, and every badly-written spreadsheet.
Put all of your colors into an array, and all of the names in another.
Now I can use a #for loop to cycle through the colors, do something with them,
and just use the text as a label.
Or you could use a multidimensional array, splitting up the red, green, and blue
components. Using nested loops, the colors could be rendered in an rgb cube to
show where colors are clustered, and how similar/different they are.
Or an rgb hexagon.
Or a triangular ternary diagram.
Or a sphere, with rgb being mapped to Theta, Phi, Radius.
Perhaps make them all spheres and connect them in a blob {}
More advanced - a macro could be used to loop through all of the color names
until "Aliceblue" was found, and then return the rgb values as the result.
Otherwise "That color name was not found." and perhaps return the default color.
Also, I recall seeing some very cool python/povray projects that you might enjoy
if you search for them.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |