Home / Blog / Developer & Web

Developer & Web

The Colour #3D46A6: RGB Values, HSL and Text Contrast

Decode #3D46A6 into RGB 61, 70, 166, check its rounded HSL values, and compare readable foreground choices for an opaque digital swatch.

The Colour #3D46A6: RGB Values, HSL and Text Contrast

Decode the exact six-character code

The hexadecimal colour #3D46A6 gives an opaque sRGB colour with red 61, green 70 and blue 166. Split the code into three pairs before doing any arithmetic: 3D is the red byte, 46 the green byte and A6 the blue byte. In base sixteen, D represents thirteen and A represents ten. The conversions are therefore 3×16+13=61, 4×16+6=70 and 10×16+6=166. The initial hash identifies colour notation; it is not part of any channel's numeric value.

Keep the channel order visible

A useful handoff record is HEX #3D46A6 and RGB (61, 70, 166), with the colour space identified as sRGB. Reversing the first and third channels would produce (166, 70, 61), a different colour with code #A6463D. The two strings contain the same three pairs, but their positions change the result. This matters when a device or file format uses a different byte order. Copy labelled values into the destination rather than assuming every three-number field expects the same order and scale.

Check the HSL result from the channel extremes

Divide the channels by 255 to obtain normalized values. The maximum is 166/255 and minimum 61/255, so HSL lightness is their average: 113.5/255, or approximately 44.51%. Their difference is 105/255. Because blue is the largest channel, the hue calculation gives approximately 234.86 degrees, and saturation is approximately 46.26%. The local Color Converter rounds these to HSL 235°, 46%, 45%. Rounded HSL is a convenient description, but storing the original HEX preserves the exact byte values when a later conversion would introduce rounding.

Use the converter with the code itself

Enter #3D46A6 in the Color Converter and press Calculate. It returns lowercase #3d46a6 alongside RGB and rounded HSL; changing letter case does not change the colour. This input cannot be compressed to a three-digit shorthand because none of the required byte pairs repeats its own digit. For example, 3D is not 33 or DD. Entering #346 instead would expand to #334466 and would not reproduce this swatch. Keep all six digits when transferring this particular colour between a design file and a stylesheet.

Choose text using a foreground-background calculation

For an opaque #3D46A6 background, the standard sRGB relative-luminance calculation gives approximately 0.08126. Its contrast ratio with white is approximately 8.00:1; with black it is approximately 2.63:1. White therefore meets the WCAG 2.2 minimum 4.5:1 ratio for ordinary text in this specific pair, while black does not. This conclusion concerns the two specified colours. The Color Converter itself does not compute contrast or certify a page, and a colour name or HSL lightness number alone cannot establish whether a text treatment is readable.

Account for overlays and state changes

A semi-transparent panel, hover colour, disabled style or image behind a control can change the effective background. Recheck the final foreground and background when such a state differs from the opaque swatch. As a simple illustration, reducing the opacity of the whole button affects both its background and text, so the white-on-blue calculation no longer describes the composed pixels. Keep foreground, background and opacity as separate design decisions. Also retain a visible focus treatment and meaningful text labels; a favourable text contrast ratio does not test keyboard operation or explain an icon's purpose.

Record the digital value without inventing a material match

Use the exact six-digit code as a digital design token when consistency across components is the aim. A name such as muted blue may help a human recognize its role, but is not a unique colour identifier and does not supply a paint or printing formula. A physical sample requires its own production specification and verification process. For a reproducible software check, convert RGB 61, 70, 166 back to hexadecimal: 61 is 3D, 70 is 46 and 166 is A6. The reconstructed code should match the original before any intentional colour adjustment.

Use the Color Converter

Open Color Converter

Source and scope

W3C: CSS colour notation and HSL

W3C: WCAG text contrast requirements and calculation