Skip to content
New issue

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

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

Already on GitHub? # to your account

Color and background query? #21

Closed
IgorKaravaev opened this issue May 13, 2016 · 3 comments
Closed

Color and background query? #21

IgorKaravaev opened this issue May 13, 2016 · 3 comments
Assignees
Labels

Comments

@IgorKaravaev
Copy link

IgorKaravaev commented May 13, 2016

I'm trying to create color and background container queries, but it doesn't work. What am I doing wrong?

.element:container(color = green) {
}
.element:container(background-color = green) {
}
@ausi
Copy link
Owner

ausi commented May 15, 2016

Thanks for reporting the issue.

Looks like this is a bug in the current implementation.

You could work around that for now, until it’s fixed, by querying the hue of the color like:

.element:container(color hue = 120deg) { }
.element:container(background-color hue = 120deg) { }
/* or */
.element:container(color hue > 110deg < 130deg) { }
.element:container(background-color hue > 110deg < 130deg) { }

@ausi ausi self-assigned this May 15, 2016
@ausi ausi added the bug label May 15, 2016
ausi added a commit that referenced this issue Jun 11, 2017
@ausi
Copy link
Owner

ausi commented Jun 11, 2017

In the next version it will be possible to query colors using the rgb() or rgba() notation:

.element:container(color = rgb(0, 128, 0)) {
}
.element:container(background-color: rgba(0, 128, 0, 1)) {
}

Support for color keywords like green would need a huge amount of code or trigger style recalculation in the browser, therefore they are not supported.

@ausi
Copy link
Owner

ausi commented Jun 12, 2017

Fixed in version 0.4.0.

@ausi ausi closed this as completed Jun 12, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants