When you define a new color using the RGBcolor function the system used is the arithmetic where color are defined by values between 0 and 1, I think.

Is there a way to use the Digital 8-bit per channel system instead? The one that ranges from 0 to 255.

Thank you.


Say you want to define a color with 8-bit RGB values {100, 125, 240}. You could use:

col = {100, 125, 240};

A couple more ways:

RGBColor["#" <> IntegerString[{10, 125, 240}, 16, 2]]

First@DominantColors@Image[{{{10, 125, 240}}}, "Byte"]


(*  RGBColor[0.0392156862745098, 0.49019607843137253`, 0.9411764705882353]  *)

Mathematica graphics


The Interpreter function does direct conversion of color specifications.

Interpreter["Color"]["RGB 64 128 255"]
(* RGBColor[64/255, 128/255, 1] *)

Note that use of "Color" requires connectivity to the Wolfram Cloud.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.