Prechádzať zdrojové kódy

LibWebView: Respect dark mode/light mode TaskManager windows

Suggested-By: Timothy Flynn <trflynn89@pm.me>
Andrew Kaster 1 rok pred
rodič
commit
eefd5edc84

+ 18 - 3
Userland/Libraries/LibWebView/ProcessManager.cpp

@@ -125,6 +125,24 @@ String ProcessManager::generate_html()
         <html>
         <html>
         <head>
         <head>
         <style>
         <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);
+                    }
+                }
+
+                @media (prefers-color-scheme: light) {
+                    tr:nth-child(even) {
+                        background: #f7f7f7;
+                    }
+                }
+
                 table {
                 table {
                     width: 100%;
                     width: 100%;
                     border-collapse: collapse;
                     border-collapse: collapse;
@@ -137,9 +155,6 @@ String ProcessManager::generate_html()
                     padding: 4px;
                     padding: 4px;
                     border: 1px solid #aaa;
                     border: 1px solid #aaa;
                 }
                 }
-                tr:nth-child(odd) {
-                    background: #f7f7f7;
-                }
         </style>
         </style>
         </head>
         </head>
         <body>
         <body>