cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
hfederovich
Level I

Change cell color using color values in cell

I have a column with different hex color codes and I would like to color each individual cell with the color of that cell's hex code.  Is this possible?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Change cell color using color values in cell

Here is the basic structure to use.....I don't know the specifics of your hex column so you will have to do that work.

dt:target col refers to the column name of the cells you want colored

names default to here(1);
dt=current data table();

for(i=1,i<=nrows(dt),i++,
	r = hex value converted to decimal;
	g = hex value converted to decimal;
	b = hex value converted to decimal;
	dt:target col << color cells( rgb color( r, g, b ), i );
);

The various functions are all documented in the Scripting Index under the Help pull down menu

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Change cell color using color values in cell

I am assuming the hex values are relatable to RGB values?
Jim
hfederovich
Level I

Re: Change cell color using color values in cell

Yes
hfederovich
Level I

Re: Change cell color using color values in cell

I found another community post on how to change them to RGB but really what I don't know how to do is then change the cell color using the value/code in that cell.
txnelson
Super User

Re: Change cell color using color values in cell

Here is the basic structure to use.....I don't know the specifics of your hex column so you will have to do that work.

dt:target col refers to the column name of the cells you want colored

names default to here(1);
dt=current data table();

for(i=1,i<=nrows(dt),i++,
	r = hex value converted to decimal;
	g = hex value converted to decimal;
	b = hex value converted to decimal;
	dt:target col << color cells( rgb color( r, g, b ), i );
);

The various functions are all documented in the Scripting Index under the Help pull down menu

Jim