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

Color: Simplifes hex notation parsing in .setStyle() #25572

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

ycw
Copy link
Contributor

@ycw ycw commented Feb 26, 2023

This PR simplifies hex to rgb in .setStyle()

when parsing 3digit hex: its safe to skip expansion (R -> RR etc) bc step size in ratio is always 1/15

before expansion: 15 steps (0x0,0x1,0x2,...,0xf), stepsize is 1, stepsize in ratio is 1/15
after expansion : 15 steps (0x00,0x11,0x22,...,0xff), stepsize is 17, stepsize in ratio is 17/255, also 1/15

when parsing 6digit hex: w/ .setHex(), hex str can be parsed just once

@Mugen87 Mugen87 added this to the r151 milestone Mar 8, 2023
@Mugen87 Mugen87 merged commit 820b3bf into mrdoob:dev Mar 8, 2023
@ycw ycw deleted the color-setstyle-hex branch March 9, 2023 09:20
This pull request was closed.
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