Skip to content

css color : add support for hue rad|grad|turn#257

Merged
aeschli merged 2 commits intomicrosoft:mainfrom
romainmenke:add-support-for-hue-turn-grad-rad--unassuming-eastern-gorilla-319fb36c89
Jan 5, 2022
Merged

css color : add support for hue rad|grad|turn#257
aeschli merged 2 commits intomicrosoft:mainfrom
romainmenke:add-support-for-hue-turn-grad-rad--unassuming-eastern-gorilla-319fb36c89

Conversation

@romainmenke
Copy link
Contributor

@romainmenke romainmenke commented Dec 23, 2021

spec

7.1. Angle Units: the type and deg, grad, rad, turn units

Angle values are s denoted by . The angle unit identifiers are:

deg
Degrees. There are 360 degrees in a full circle.

grad
Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle.

rad
Radians. There are 2π radians in a full circle.

turn
Turns. There is 1 turn in a full circle.


Aiming to get the color indicator here :

color: hsl(0.5turn 100% 50%);
color: hsl(200grad 100% 50%);
color: hsl(3.14159rad 100% 50%);

Screenshot 2021-12-23 at 10 45 19

@ghost
Copy link

ghost commented Dec 23, 2021

CLA assistant check
All CLA requirements met.

@romainmenke
Copy link
Contributor Author

@aeschli could you take a look when you have time?

Happy to make any needed changes :)

case 'deg':
return parseFloat(val) % 360;
case 'rad':
return parseFloat(val) * 180 / Math.PI;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 'rad', 'grad' and 'turn', can they represent multiple turns? Should we add a modulo 360 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Will check.
Good catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been updated.

@aeschli
Copy link
Collaborator

aeschli commented Jan 5, 2022

Cool thanks for the PR and the quick update!

@aeschli aeschli merged commit ee11fcc into microsoft:main Jan 5, 2022
@aeschli aeschli added this to the January 2022 milestone Jan 5, 2022
@aeschli aeschli self-assigned this Jan 5, 2022
@romainmenke romainmenke deleted the add-support-for-hue-turn-grad-rad--unassuming-eastern-gorilla-319fb36c89 branch January 5, 2022 10:09
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

Successfully merging this pull request may close these issues.

2 participants