Update snippet descriptions
This commit is contained in:
@ -3,7 +3,7 @@ title: hexToRGB
|
||||
tags: string,math,advanced
|
||||
---
|
||||
|
||||
Converts a color code to a `rgb()` or `rgba()` string if alpha value is provided.
|
||||
Converts a color code to an `rgb()` or `rgba()` string if alpha value is provided.
|
||||
|
||||
- Use bitwise right-shift operator and mask bits with `&` (and) operator to convert a hexadecimal color code (with or without prefixed with `#`) to a string with the RGB values.
|
||||
- If it's 3-digit color code, first convert to 6-digit version.
|
||||
|
||||
Reference in New Issue
Block a user