ladybird/Userland/Libraries/LibWebView/SourceHighlighter.h
Timothy Flynn 1fe486cebe LibWebView: Implement a WebView-based Inspector client
This is modeled after a similar implementation for the JS console.

This client takes over an inspector WebView (created by the chrome) to
create the inspector application. Currently, this application includes
the DOM tree and accessibility tree as a first pass. It can later be
extended to included the style tables, the JS console itself, etc.
2023-11-24 08:37:19 +01:00

69 lines
1.4 KiB
C++

/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/StringView.h>
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;
}
.internal {
color: darkgrey;
}
}
@media (prefers-color-scheme: light) {
.comment {
color: green;
}
.tag {
color: red;
}
.attribute-name {
color: darkorange;
}
.attribute-value {
color: blue;
}
.internal {
color: dimgray;
}
}
)~~~"sv;
}