Kivy rgba (0 - 1) vs. regular rgba (0-255)

1,071 views
Skip to first unread message

Ao Yen

unread,
Apr 1, 2014, 3:25:48 PM4/1/14
to kivy-...@googlegroups.com
Hello all,

So when setting a Color property using rgba in Kivy we need to use a value between 0 and 1.
For my application design I often refer to Adobe's Kuler website to find complementary colors.
Adobe also provides HEX values for colors and I understand that Kivy-utils has a function to convert this to Kivy rgba 0 - 1.

Can someone contribute about the relationship between 0-1 and 0-255 rgba? I've looked at the OpenGL website for this but to be honest
anything beyond pure basic graphics instruction computer science is above my amateur knowledge level.

Alexander Taylor

unread,
Apr 1, 2014, 4:26:33 PM4/1/14
to kivy-...@googlegroups.com
The 0-1 value is just the 0-255 value divided by 255. E.g. on the 255 scale, 100 would equal 100/255 = 0.392... on the 0-1 scale.

There's nothing very special here, just different places use different conventions. Kivy (and opengl) use the 0-1 convention, so just convert your 0-255 values with a simple division.

Ao Yen

unread,
Apr 1, 2014, 5:53:06 PM4/1/14
to kivy-...@googlegroups.com
Well that was easier than expected. Thanks!
Reply all
Reply to author
Forward
0 new messages