kota's memex


Finds color codes from STDIN and replaces them with a new format:

$ echo 'rgb(155,112,255)' | colorswap -hex

You can pass in a huge file intermingled with text, code, and colors. The output (and detectable input) formats are:

hex:  #9b70ff
rgb:  rgb(155,112,255)
rgba: rgba(155,112,255,128)
vec3: vec3(0.607843,0.439216,1.000000)
vec4: vec4(0.607843,0.439216,0.500000)

Capitalization doesn't matter for hex inputs, and the shorthand form #EEE is accepted. For the other formats, spaces are accepted after the commas and you can use less precision in your vecs.