diff --git a/Userland/Libraries/LibWebView/SourceHighlighter.cpp b/Userland/Libraries/LibWebView/SourceHighlighter.cpp index 38a31605e0..0807e21097 100644 --- a/Userland/Libraries/LibWebView/SourceHighlighter.cpp +++ b/Userland/Libraries/LibWebView/SourceHighlighter.cpp @@ -23,51 +23,11 @@ String highlight_source(URL const& url, StringView source) )~~~"sv); builder.appendff("View Source - {}", url); - + builder.appendff("", HTML_HIGHLIGHTER_STYLE); builder.append(R"~~~( - -
+
 )~~~"sv);
 
     size_t previous_position = 0;
diff --git a/Userland/Libraries/LibWebView/SourceHighlighter.h b/Userland/Libraries/LibWebView/SourceHighlighter.h
index 69345cf5c9..2d4f204947 100644
--- a/Userland/Libraries/LibWebView/SourceHighlighter.h
+++ b/Userland/Libraries/LibWebView/SourceHighlighter.h
@@ -13,4 +13,50 @@ namespace WebView {
 
 String highlight_source(URL const&, StringView);
 
+constexpr inline StringView HTML_HIGHLIGHTER_STYLE = R"~~~(
+    .html {
+        font-size: 10pt;
+        font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
+    }
+
+    .tag {
+        font-weight: 600;
+    }
+
+    @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;
+        }
+        .comment {
+            color: lightgreen;
+        }
+        .tag {
+            color: orangered;
+        }
+        .attribute-name {
+            color: orange;
+        }
+        .attribute-value {
+            color: deepskyblue;
+        }
+    }
+
+    @media (prefers-color-scheme: light) {
+        .comment {
+            color: green;
+        }
+        .tag {
+            color: red;
+        }
+        .attribute-name {
+            color: darkorange;
+        }
+        .attribute-value {
+            color: blue;
+        }
+    }
+)~~~"sv;
+
 }