color to midi hex text

152 viewsCSS Questionscolor sysex
0

Hi!

i would like to transfer color via midi

as i see the track color is:

The RGB value of the track’s color in the form 0x00rrggbb or (2^16 * red) + (2^8) * green + blue, where red, green and blue are values from 0 (dark) to 255 (light).

how that can be converted to sysex message?

i have tried str() function – but it translates into numbers that have less than 3 digits sometimes…

need help!!)

HDV Answered question June 28, 2024
0

Hi,

let “z” be the rgb-value in decimal, then you can calculate red, green and blue parts in the form:

red = z//65536
z = z – red*65536
green = z//256
blue = z – green*256

Regards

Dieter

HDV Answered question June 28, 2024