Conversion Iteration #2: Color

March 14, 2022
screenshot of converter

For iteration #2: I added Hex color to RGB to the conversion app page converter.

Hex:

This will take the 6-digit hex color only accepting 0-9 and A-F. Then it will convert the Hex to RGB with commas between the 3 color grouping.

RGB:

For the RGB to Hex the user will need to include the commas between the color groupings. This will convert it over to the Hex coding, making the A-F in caps. While it doesn’t matter in the hex code if it’s upper or lowercase I’ve always preferred to have it in uppercase making it a bit quicker to spot in the code. The RGB separated by commas since this is how it’s expected in most programs.

Looking up the formulas for the conversion took some time, found a few different ones but after some trials got one that matched the sample version.

For testing I used: https://en.wikipedia.org/wiki/Web_colors
In my testing I used about 20 colors or more to test the conversions between the two. About 10 for hex to see if the RGB is correct then reversed it for other colors. I used different color types like close to white, reds, blues, a green, and a dark gray.

Related Articles

Tic-Tac-Toe in JavaScript

Tic-Tac-Toe in JavaScript

To take a break from the other projects this weekend I worked on a Tic-Tac-Toe game in JavaScript. The basic instructions I had for myself was it needed to be able to be played by 1 or 2 people. I started with creating the game for 2 players. Thinking that if I can...

read more
Save posts to a WordPress Database – Working Notes

Save posts to a WordPress Database – Working Notes

This is notes/overview of a project I started on to add several posts to WordPress (WP) from HTML files without having to copy and paste each file. These are just notes from that dropped project and the basic Python script to do this (github). Make sure you fully test...

read more
CMYK converter added

CMYK converter added

CMYK is a tricky one, since each device would interpret the colors differently. Had almost decided not to even include it but thought it could be useful at times. Looking around I found a basic formula that most people were using to give a rough idea for the color. I...

read more

Pin It on Pinterest

Share This