BBC BASIC
« Re: New tool color management (num,color or RGB) »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 6:12pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Re: New tool color management (num,color or RGB)  (Read 433 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: New tool color management (num,color or RGB)
« Thread started on: May 22nd, 2016, 10:13am »

on May 22nd, 2016, 03:03am, michael wrote:
you can use RGB values like 010200100 -which is 10,200,100

I wonder why you are using this decimal notation when hexadecimal RGB values are so much more common (your example colour would be 0AC864 in hex). The 'web' (specifically HTML) uses hexadecimal RGB values so you can't get much more standard than that!

Apart from the standardisation issue, conversion from hexadecimal is straightforward:

Code:
      hex$ = "0AC864"
      rgb% = EVAL("&"+hex$)
      r& = rgb% >> 16
      g& = rgb% >> 8
      b& = rgb% 

(here using byte variables to avoid explicitly AND-ing with &FF).

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls