LibWeb/CSS: Implement the color-scheme CSS property

This commit is contained in:
Gingeh 2025-01-02 12:59:09 +11:00 committed by Sam Atkins
commit ce5cd012b9
Notes: github-actions[bot] 2025-01-08 11:19:41 +00:00
36 changed files with 618 additions and 370 deletions

View file

@ -130,12 +130,6 @@ String ProcessManager::generate_html()
<title>Task Manager</title>
<style>
@media (prefers-color-scheme: dark) {
/* FIXME: We should be able to remove the HTML style when "color-scheme" is supported */
html {
background-color: rgb(30, 30, 30);
color: white;
}
tr:nth-child(even) {
background: rgb(57, 57, 57);
}
@ -147,6 +141,10 @@ String ProcessManager::generate_html()
}
}
html {
color-scheme: light dark;
}
table {
width: 100%;
border-collapse: collapse;

View file

@ -79,13 +79,6 @@ String highlight_source(URL::URL const& url, URL::URL const& base_url, StringVie
constexpr inline StringView HTML_HIGHLIGHTER_STYLE = R"~~~(
@media (prefers-color-scheme: dark) {
/* FIXME: We should be able to remove the HTML style when "color-scheme" is supported */
html {
background-color: rgb(30, 30, 30);
color: white;
counter-reset: line;
}
:root {
--comment-color: lightgreen;
--keyword-color: orangered;
@ -111,6 +104,10 @@ constexpr inline StringView HTML_HIGHLIGHTER_STYLE = R"~~~(
}
}
html {
color-scheme: light dark;
}
.html {
font-size: 10pt;
font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;