0

I want to fill up a seekbar with 256 colors, that means 8 bit color ( RRRGGGBB ).That means I will have only 4 colors of blue and 8 colors of red and green and then make combinations between them.

                    if (progress < 256) {
                        b = progress;
                    } else if (progress < 256 * 2) {
                        g = progress % 256;
                        b = 256 - progress % 256;
                    } else if (progress < 256 * 3) {
                        g = 255;
                        b = progress % 256;
                    } else if (progress < 256 * 4) {
                        r = progress % 256;
                        g = 256 - progress % 256;
                        b = 256 - progress % 256;
                    } else if (progress < 256 * 5) {
                        r = 255;
                        g = 0;
                        b = progress % 256;
                    } else if (progress < 256 * 6) {
                        r = 255;
                        g = progress % 256;
                        b = 256 - progress % 256;
                    } else if (progress < 256 * 7) {
                        r = 255;
                        g = 255;
                        b = progress % 256;
                    }

This code is for normal color picker, but I need only 255 colors combined, how can I make the changes ? I am out of ideeas and I don't really need black in the color picker.

Marian Pavel
  • 2,726
  • 8
  • 29
  • 65
  • If using a pre-existing solution is an option for you, the following question might be helpful: http://stackoverflow.com/q/2442407/87698 – Heinzi Mar 20 '15 at 10:08
  • I already tried some libraries to implement but I really need to consider that I can send colors to my DB only in 8 bit format, so I can have only 256 maximum colors. – Marian Pavel Mar 20 '15 at 10:10
  • Ah, ok, makes sense. How does an 8-bit color map to a full RGB color? E.g.., what would 1001010 become in terms of full RGB? – Heinzi Mar 20 '15 at 10:24
  • @PavelMarian : Why does your DB only accept 8-bit values? – Squonk Mar 20 '15 at 10:41
  • The micro chip I work with it is blocked with this arhitecture and I can have only 256 values of colors, so a RRR GGG BB would have 8 Red colors * 8 Green Colors * 4 Blue Colors = 256 colors. I think I have figured out a solution to combine those colors in a seekbar. I will post after I succeed. – Marian Pavel Mar 20 '15 at 10:58

0 Answers0