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

[css-env] env(theme-color) or: Access to Author-Specified Document Metadata #575

Open
Crissov opened this issue Oct 6, 2016 · 4 comments

Comments

@Crissov
Copy link
Contributor

Crissov commented Oct 6, 2016

Like local element attributes with attr(), it would sometimes be handy to be able to access document-wide meta data, e.g. with HTML:

<meta name="theme-color" content="#F00B42">
h1 {color: meta("theme-color" color, red;)}
h2 {background: meta("theme-color" color, red;)}
@upsuper
Copy link
Member

upsuper commented Oct 9, 2016

Why not just use CSS variable?

@Crissov
Copy link
Contributor Author

Crissov commented Oct 12, 2016

Over at the WHATWG issue, the original example was:

:root {--ThemeColor: meta("theme-color" color, "theme_color" color, #3F51B5);/* like attr() */}

That means, meta() would be used with CSS Variables, but could also be used without them.

@tabatkins tabatkins added css-env-1 and removed css-values-4 Current Work labels Jun 21, 2018
@tabatkins
Copy link
Member

This ends up falling under the env() function now, so I'm retagging this as a suggestion for new env() values.

@tabatkins tabatkins changed the title [css-values] meta() – Access Document Metadata [css-env] suggestions for new env() values Jun 21, 2018
@Crissov Crissov changed the title [css-env] suggestions for new env() values [css-env] env(theme-color) or: Access to Author-Specified Document Metadata Nov 29, 2019
@Crissov
Copy link
Contributor Author

Crissov commented Nov 29, 2019

While theme-color could be added as a predefined environment variable, this issue is probably rather about CSS access to document-specific metadata, which can be divided into author-specified values (e. g. <title> with a fixed key #3685 and <meta> with possibly custom keys #2627 #2629 in HTML) and automatically derived properties (e. g. file size or date and protocol headers, e. g. HTTP). Some metadata that is available for the whole document may also be available for individual (e. g. title from the closest ancestor title attribute in HTML or description from <desc> child in SVG).

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

3 participants