night_owl.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. """
  2. pygments.styles.night_owl
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~
  4. Pygments version of the `Night Owl` theme by Sarah Drasner.
  5. Based on https://github.com/sdras/night-owl-vscode-theme.
  6. :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
  7. :license: BSD, see LICENSE for details.
  8. """
  9. from pygments.style import Style
  10. from pygments.token import Comment, Error, Generic, Keyword, Name, Number, \
  11. Operator, Punctuation, String, Text, Token, Whitespace
  12. __all__ = ['NightOwlStyle']
  13. # Night Owl color palette
  14. background = '#011627'
  15. foreground = '#d6deeb'
  16. selection = '#1d3b53'
  17. cyan = '#7fdbca'
  18. blue = '#82aaff'
  19. purple = '#c792ea'
  20. green = '#addb67'
  21. yellow = '#ecc48d'
  22. orange = '#f78c6c'
  23. red = '#ef5350'
  24. comment = '#637777'
  25. pink = '#ff869a'
  26. class NightOwlStyle(Style):
  27. """
  28. Night Owl theme by Sarah Drasner.
  29. A theme for the night owls amongst us. Fine-tuned for those of us who
  30. like to code late into the night. Color choices have also taken into
  31. consideration what is accessible to those with color blindness and in
  32. low-light circumstances.
  33. Based on the VS Code Night Owl theme:
  34. https://github.com/sdras/night-owl-vscode-theme
  35. .. versionadded:: 2.21
  36. """
  37. name = 'night-owl'
  38. background_color = background
  39. highlight_color = selection
  40. line_number_color = comment
  41. line_number_background_color = background
  42. line_number_special_color = foreground
  43. line_number_special_background_color = selection
  44. styles = {
  45. Token: foreground,
  46. Whitespace: foreground,
  47. Text: foreground,
  48. # Comments
  49. Comment: 'italic ' + comment,
  50. Comment.Multiline: 'italic ' + comment,
  51. Comment.Preproc: cyan,
  52. Comment.Single: 'italic ' + comment,
  53. Comment.Special: 'italic ' + comment,
  54. # Keywords
  55. Keyword: 'italic ' + purple,
  56. Keyword.Constant: 'italic ' + purple,
  57. Keyword.Declaration: 'italic ' + purple,
  58. Keyword.Namespace: 'italic ' + purple,
  59. Keyword.Reserved: 'italic ' + purple,
  60. Keyword.Type: cyan,
  61. # Names
  62. Name: foreground,
  63. Name.Attribute: yellow,
  64. Name.Builtin: cyan,
  65. Name.Builtin.Pseudo: 'italic ' + blue,
  66. Name.Class: yellow,
  67. Name.Constant: orange,
  68. Name.Decorator: blue,
  69. Name.Entity: orange,
  70. Name.Exception: red,
  71. Name.Function: blue,
  72. Name.Function.Magic: cyan,
  73. Name.Label: foreground,
  74. Name.Namespace: foreground,
  75. Name.Other: foreground,
  76. Name.Property: cyan,
  77. Name.Tag: pink,
  78. Name.Variable: foreground,
  79. Name.Variable.Class: yellow,
  80. Name.Variable.Global: orange,
  81. Name.Variable.Instance: yellow,
  82. # Literals
  83. Number: orange,
  84. Number.Float: orange,
  85. Number.Hex: orange,
  86. Number.Integer: orange,
  87. Number.Oct: orange,
  88. # Strings
  89. String: green,
  90. String.Affix: cyan,
  91. String.Char: green,
  92. String.Doc: 'italic ' + comment,
  93. String.Escape: yellow,
  94. String.Heredoc: green,
  95. String.Interpol: cyan,
  96. String.Other: green,
  97. String.Regex: cyan,
  98. String.Symbol: cyan,
  99. # Operators
  100. Operator: cyan,
  101. Operator.Word: 'italic ' + purple,
  102. # Punctuation
  103. Punctuation: foreground,
  104. # Errors
  105. Error: red,
  106. # Generic tokens (used by diffs, prompts, etc.)
  107. Generic: foreground,
  108. Generic.Deleted: red,
  109. Generic.Emph: 'italic',
  110. Generic.Error: red,
  111. Generic.Heading: 'bold ' + blue,
  112. Generic.Inserted: green,
  113. Generic.Output: comment,
  114. Generic.Prompt: 'bold ' + cyan,
  115. Generic.Strong: 'bold',
  116. Generic.EmphStrong: 'bold italic',
  117. Generic.Subheading: 'bold ' + cyan,
  118. Generic.Traceback: red,
  119. }