Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I convert #FF00 to red(#FF0000)? #190

Closed
maltoze opened this issue Dec 24, 2020 · 4 comments
Closed

How can I convert #FF00 to red(#FF0000)? #190

maltoze opened this issue Dec 24, 2020 · 4 comments

Comments

@maltoze
Copy link

maltoze commented Dec 24, 2020

Currently it converts #FF00 to #FFFF00.

> const color = require('color')
> color('#FF00').hex()
'#FFFF00'

Is there any way to convert from #FF00 to #FF0000?
Thanks.

@Qix-
Copy link
Owner

Qix- commented Dec 24, 2020

No, because that doesn't make any sense. #FF00 equates to #FFFF0000 (alpha of 0) as per the CSS specification. I think you're misunderstanding how hex color shorthand works 😉

Shorthand for red is #F00.

@Qix- Qix- closed this as completed Dec 24, 2020
@maltoze
Copy link
Author

maltoze commented Dec 24, 2020

var worldString = 'Hello, world';

console.log(worldString.fontcolor('red') +  ' is red in this line');
// '<font color="red">Hello, world</font> is red in this line'

console.log(worldString.fontcolor('FF00') + ' is red in hexadecimal in this line');
// '<font color="FF00">Hello, world</font> is red in hexadecimal in this line'

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fontcolor#Using_fontcolor

@Qix- But why is FF00 here in red?

@Qix-
Copy link
Owner

Qix- commented Dec 24, 2020

That is the <font> tag that hasn't been used in decades. Its color semantics are not governed by CSS. What are you trying to do? Don't use the font tag...

@maltoze
Copy link
Author

maltoze commented Dec 25, 2020

I'm parsing a old website which has a lot of font tag...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants