I used to find color codes which I want to use for texts or background colors on htmls with
color edit tool of
MS paint which pre-installed on Windows.
But now I use Mac instead of Windows.
How can I find color codes with Mac?
Is an software like MS paint pre-installed on Mac?
There is also a utility (in Applications/Utilities) called DigitalColor Meter, which shows the color code of whatever you're hovering at the moment. It's a bit more lightweight than Preview. There are also shortcuts for copying the color value as a string or image.
The Digital Color Meter in /Applications/Utilities/ is the best choice.
Color panel - picker
This picker is almost everywhere if you look carefully.
Look closely at font controls and you will likely see wording like
Everywhere when you can show the font panel (usually ⌘T), you can click the "Text color" icon in the font panel and you will get again the "Color panel" (with picker).
You can for example when entering text into textbox here, right click for bring up contextual menu, and go to "Font -> Show colors" directly from the Safari... This works in every application where you can change fonts.
In every application where you can change the color for anything with color field, you can click the border of "color field" and you will get the color panel again. For example Terminal.app -> Preferences -> Settings (color fields for text and Cursor colors)
You can download a plugin into color panel for hexadecimal color values.
If you find yourself needing the DCM often, you might look at using Automator.app to create a global "Service" that launches the Digital Color Meter.app. Now you are a few clicks away and can additionally bind this new service to a global hotkey in the System Preferences. The result: running DCM from anywhere, anytime, on a custom key command.
Here are several more things - but lastly: you can also run Windows in VirualBox and use the MsPaint method. /joking/ - be cool. :) :)
I quite like the completely-free app Spot Color. It uses the Mac's built-in color pickers and allows you to grab the color and then use the various sliders and color models to modify it, as you asked about in your followup comment.
Since it uses the Mac's color pickers it means you can also use any of the various additional color pickers out on the web, such as: