Page 1 of 1

Auto Calculate RGB color using cell references R G B values

Posted: Fri Dec 07, 2018 9:29 pm
by IsabelDalhousie
Hello All ... I'm trying to create a spreadsheet showing a list of custom RGB colors in the cell backgrounds. I've figured out I can do this by manually creating each new RGB value in the color pallet - then applying it. BUT my challenge is I have many to create and I feel this should be possible (and more transparent for editing ) by simply listing the R, G, B values in separate cells and then asking OO to use these references to go fetch the RGB cell background color and apply it. Can anyone give me guidance on how to get there easily? Thanks in advance,

Isabel

Re: Auto Calculate RGB color using cell references R G B val

Posted: Fri Dec 07, 2018 10:06 pm
by Villeroy
download/file.php?id=14875 includes a macro on Module2 which generates styles from a cell range selection.

Copy Module2 to your document or to the global name space ("My Macros")
Create a user-defined cell style. In the example document it is style "Black" according to the constant cParent="Black" on Module2.
Select 2 columns of cells where the first column contains style names and the second contains integer numbers derived from RGB hexadecimals.
Call the "Main" routine.
Another macro "cleanUpStyles" deletes all styles below the parent style keeping all the other styles which have nothing to do with that macro.

Re: Auto Calculate RGB color using cell references R G B val

Posted: Sat Dec 08, 2018 1:37 am
by IsabelDalhousie
Villeroy thank you for your speedy reply. I downloaded the file and confess I'm a little intimidated by the challenge .... but the plot thickens ....

I started by validating what I thought I had already done yesterday - create some new RGB names and colors to add to the basic pallet using open office/preferences/colors ... while doing this I discovered that what I created last night was not stable ... in other words I had created a name and RGB using the drop down and thought I had saved it ... but when I go back in the RGB codes for that name have changed!! There's something that's not intuitive about how to create new colors so since I can't risk the results being incorrect I'm going to abandon this project for now .... I hope I haven't put off other users who may come across this. I may come back to it later. Thanks for your support Villeroy .. happy holidays

Re: Auto Calculate RGB color using cell references R G B val

Posted: Sat Dec 08, 2018 2:00 am
by John_Ha

Re: Auto Calculate RGB color using cell references R G B val

Posted: Sat Dec 08, 2018 2:34 am
by IsabelDalhousie
Thanks John, this is helpful as a resource and at least puts my problems in perspective - I only have to manage less than 100 colors!