Question about hexadecimal color codes

Hello, in the text of plotting New York high school locations on a city map, the below code is used

m.drawcoastlines(color='#6D5F47', linewidth=.4)
m.drawrivers(color='#6D5F47', linewidth=.4)

I am wondering what is the source of the color like ‘#85A6D9’. What does this sequence represent and how do we select the one that serves our purpose? Thank you!

Hi @cmusongyang: In future, please provide a question link as per these guidelines.

In computers, colours are represented using a combination of Red, Green and Blue or RGB. Each of these colours take up a byte of memory, which can be represented in binary which are 0s and 1s. A byte is made up of bits (or a series of 8 0s and 1s). Humans came up with a number system called Hexadecimal or hex so that you don’t have to read binary which can be rather tedious, for a simpler and more compact version of the data stored or processed.

The first 2 characters of #85A6D9, which is 85 represents the hex value for red. A6 represents the hex value for green and D9 represents the hex value for blue. Based on the colour combination intensities, other colours are derived. You can try googling this and you get a cyan-ish colour as shown below.

If you want to learn more about this, I suggest that you check out the first lecture of CS50 here about how colours and other data are represented in computers.

I think its up to you to decide what colours you want to use, but of course I recommend using symbolic (like green for forests in the case of maps) or complementary colours when plotting visualisations.

Hope this helps!

Thank you, this is very informative!

Hi @cmusongyang:

If my reply helped you to understand the concept, kindly mark my reply as the solution. Thanks!