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

Consolidate color spaces to a single class #20

Open
sebastiandedeyne opened this issue Jan 13, 2017 · 1 comment
Open

Consolidate color spaces to a single class #20

sebastiandedeyne opened this issue Jan 13, 2017 · 1 comment
Assignees
Milestone

Comments

@sebastiandedeyne
Copy link
Member

Brain dump incoming

Consolidate all color spaces in a single color class that holds the color information.

rgb, rgba and hex all use the same color space. hls uses a different one so would need to be stored differently or we'd lose data.

API sketch:

Color::fromString('rgb(255, 0, 255)');

// Formats return diffrent objects depending on the  format
$color->rgb()->__toString();
$color->rgb()->red();
$color->hex()->red();

// $color->rgb()->toHls() should also be possible

// Changing color spaces requires an explicit conversion (different implementation of `Color`)
// For example, you can't get `red` from a `hls` color
$color->toHls()->hue();
@sebastiandedeyne sebastiandedeyne added this to the v2 milestone Jan 13, 2017
@sebastiandedeyne sebastiandedeyne self-assigned this Jan 13, 2017
@sebastiandedeyne
Copy link
Member Author

Closing for now. Might come back later.

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

No branches or pull requests

1 participant