Benutzer-Werkzeuge

Webseiten-Werkzeuge


de:sysadmin:tools:farbe

Farbtabelle

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 :-)


de/sysadmin/tools/farbe.txt · Zuletzt geändert: 2013-04-29 14:34 von hella

Seiten-Werkzeuge

Mastodon Twitter