I need a script or scripts that will allow me to manipulate HTML Hex Colors.
All the colors are in the format #FFFFFF, which are always 6 hex digits preceded by the "#" symbol. No colors are ever referenced by name, and none are ever referenced by a 3 digit shortcut cheat. Should be simple enough in a find/replace, but it's the manipulation I need some assistance with.
I have several files with hundreds of occurrences of the colors that need to be changed. They need to be able to be manipulated in several different ways, but I want a script that will do only one of the functions for an entire "current open file" only.
Function 1: Swap Red and Blue.
Function 2: Swap Green and Blue.
Function 3: Swap Green and Red.
Function 4: Invert Red only. (by subtracting from hex FF)
Function 5: Invert Green only. (by subtracting from hex FF)
Function 6: Invert Blue only. (by subtracting from hex FF)
Providing me with a script that will swap any 2 colors or that will invert any one color should show me how it is done, and I should be able to produce the other scripts needed. This particular work is as a hobby so I can see how certain things work, and polish my skills a bit, I hope. I'm afraid I haven't written a script for UltraEdit in a couple of years, nor have I written any JavaScript in that long. Time to start getting back into it, I suppose.
EDIT: Also, one other thing I would absolutely love to have, but am not sure how to do it, is to invert the luminosity of the color, without effecting hue and saturation. I will settle for color swapping and inversion, but could really use the luminosity invert as well.
All the colors are in the format #FFFFFF, which are always 6 hex digits preceded by the "#" symbol. No colors are ever referenced by name, and none are ever referenced by a 3 digit shortcut cheat. Should be simple enough in a find/replace, but it's the manipulation I need some assistance with.
I have several files with hundreds of occurrences of the colors that need to be changed. They need to be able to be manipulated in several different ways, but I want a script that will do only one of the functions for an entire "current open file" only.
Function 1: Swap Red and Blue.
Function 2: Swap Green and Blue.
Function 3: Swap Green and Red.
Function 4: Invert Red only. (by subtracting from hex FF)
Function 5: Invert Green only. (by subtracting from hex FF)
Function 6: Invert Blue only. (by subtracting from hex FF)
Providing me with a script that will swap any 2 colors or that will invert any one color should show me how it is done, and I should be able to produce the other scripts needed. This particular work is as a hobby so I can see how certain things work, and polish my skills a bit, I hope. I'm afraid I haven't written a script for UltraEdit in a couple of years, nor have I written any JavaScript in that long. Time to start getting back into it, I suppose.
EDIT: Also, one other thing I would absolutely love to have, but am not sure how to do it, is to invert the luminosity of the color, without effecting hue and saturation. I will settle for color swapping and inversion, but could really use the luminosity invert as well.