8000 How to attach alpha value to hex string output? · color-js color.js · Discussion #446 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

How to attach alpha value to hex string output? #446

Answered by MysteryBlokHed
IDrumsey asked this question in Q&A
Discussion options

You must be logged in to vote

The alpha value is automatically included when it is not 1:

const color = new Color("red");
color.toString({ format: "hex" }); // "#f00"
color.alpha = 0.5;
color.toString({ format: "hex" }); // "#ff000080" 

Replies: 1 comment

Comment options
8000

You must be logged in to vote
0 replies
Answer selected by MysteryBlokHed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
0