SourceHighlighter.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <AK/StringView.h>
  9. namespace WebView {
  10. String highlight_source(URL::URL const&, StringView);
  11. constexpr inline StringView HTML_HIGHLIGHTER_STYLE = R"~~~(
  12. .html {
  13. font-size: 10pt;
  14. font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  15. }
  16. .tag {
  17. font-weight: 600;
  18. }
  19. @media (prefers-color-scheme: dark) {
  20. /* FIXME: We should be able to remove the HTML style when "color-scheme" is supported */
  21. html {
  22. background-color: rgb(30, 30, 30);
  23. color: white;
  24. }
  25. .comment {
  26. color: lightgreen;
  27. }
  28. .tag {
  29. color: orangered;
  30. }
  31. .attribute-name {
  32. color: orange;
  33. }
  34. .attribute-value {
  35. color: deepskyblue;
  36. }
  37. .internal {
  38. color: darkgrey;
  39. }
  40. }
  41. @media (prefers-color-scheme: light) {
  42. .comment {
  43. color: green;
  44. }
  45. .tag {
  46. color: red;
  47. }
  48. .attribute-name {
  49. color: darkorange;
  50. }
  51. .attribute-value {
  52. color: blue;
  53. }
  54. .internal {
  55. color: dimgray;
  56. }
  57. }
  58. )~~~"sv;
  59. }