Ziel: eine umfangreiche Farbliste mit Hexcode und Farbnamen (ohne Leerzeichen)
#fffafa snow #f8f8ff ghostwhite #f5f5f5 whitesmoke #dcdcdc gainsboro #fffaf0 floralwhite #fdf5e6 oldlace #faf0e6 linen #faebd7 antiquewhite #ffefd5 papayawhip #ffebcd blanchedalmond [...]
Ausgangsbasis ist die Datei /usr/share/X11/rgb.txt
:
255 250 250 snow 248 248 255 ghost white 248 248 255 GhostWhite 245 245 245 white smoke 245 245 245 WhiteSmoke 220 220 220 gainsboro 255 250 240 floral white 255 250 240 FloralWhite 253 245 230 old lace 253 245 230 OldLace [...]
1ster Versuch:
cat /usr/share/X11/rgb.txt | \ grep -v '^!'| \ perl -ane '($rr,$gg,$bb,$color)=@F; print sprintf("#%.2x%.2x%.2x %s\n",$rr,$gg,$bb,$color) ;'
… wenn ich mir das im nachhinein ansehe: absolut ein Anwärter für den "Useless Use of Cat Award"
→ http://partmaps.org/era/unix/award.html
2ter Versuch:
grep -v '^!' /usr/share/X11/rgb.txt | \ perl -ane '($rr,$gg,$bb,$color)=@F; print sprintf("#%.2x%.2x%.2x %s\n",$rr,$gg,$bb,$color) ;'
uups, da sind ja einige Farben doppelt ..
grep -v '^!' /usr/share/X11/rgb.txt | \ perl -ane '($rr,$gg,$bb,$c1,$c2)=@F; $color=$c1.$c2; $color = lc($color);$color=~s/gray/grey/; print sprintf("#%.2x%.2x%.2x %s%s\n",$rr,$gg,$bb,$color) ;' |uniq
… ohne grep und uniq kann man sicher auch noch auskommen, aber an perl-onliner muß ich mich immer langsam anschleichen
gilt für alle Tipps, Tricks & Spickzettel:
dies sind einfache, teils banale Notizen für meinen persönlichen Gebrauch,
die hier eher zufällig auch öffentlich lesbar sind
(vielleicht hilft es ja jemandem weiter). Verwendung auf eigene Gefahr
Fehler-Hinweise, Dankesschreiben , etc. bitte an: web.21@unixwitch.de
weitere Tools / Spickzettel