gh_dark.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. """
  2. pygments.styles.gh_dark
  3. ~~~~~~~~~~~~~~~~~~~~~~~
  4. Github's Dark-Colorscheme based theme for Pygments
  5. Colors extracted from https://github.com/primer/primitives
  6. :copyright: Copyright 2006-2024 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 Keyword, Name, Comment, Error, Number, Operator, \
  11. Generic, Text, Literal, String, Token
  12. __all__ = ['GhDarkStyle']
  13. # vars are defined to match the defs in
  14. # - [GitHub's VS Code theme](https://github.com/primer/github-vscode-theme) and
  15. # - [Primer styles](https://github.com/primer/primitives)
  16. RED_2 = "#ffa198"
  17. RED_3 = "#ff7b72"
  18. RED_9 = "#490202"
  19. ORANGE_2 = "#ffa657"
  20. ORANGE_3 = "#f0883e"
  21. GREEN_1 = "#7ee787"
  22. GREEN_2 = "#56d364"
  23. GREEN_7 = "#0f5323"
  24. BLUE_1 = "#a5d6ff"
  25. BLUE_2 = "#79c0ff"
  26. PURPLE_2 = "#d2a8ff"
  27. GRAY_3 = "#8b949e"
  28. GRAY_4 = "#6e7681"
  29. FG_SUBTLE = "#6e7681"
  30. FG_DEFAULT = "#e6edf3"
  31. BG_DEFAULT = "#0d1117"
  32. DANGER_FG = "#f85149"
  33. class GhDarkStyle(Style):
  34. """
  35. Github's Dark-Colorscheme based theme for Pygments
  36. """
  37. name = 'github-dark'
  38. background_color = BG_DEFAULT
  39. # has transparency in VS Code theme as `colors.codemirror.activelineBg`
  40. highlight_color = GRAY_4
  41. line_number_special_color = FG_DEFAULT
  42. line_number_special_background_color = FG_SUBTLE
  43. line_number_color = GRAY_4
  44. line_number_background_color = BG_DEFAULT
  45. styles = {
  46. Token: FG_DEFAULT,
  47. Error: DANGER_FG,
  48. Keyword: RED_3,
  49. Keyword.Constant: BLUE_2,
  50. Keyword.Pseudo: BLUE_2,
  51. Name: FG_DEFAULT,
  52. Name.Class: "bold "+ORANGE_3,
  53. Name.Constant: "bold "+BLUE_2,
  54. Name.Decorator: 'bold '+PURPLE_2,
  55. Name.Entity: ORANGE_2,
  56. Name.Exception: "bold "+ORANGE_3,
  57. Name.Function: 'bold '+PURPLE_2,
  58. Name.Label: "bold "+BLUE_2,
  59. Name.Namespace: RED_3,
  60. Name.Property: BLUE_2,
  61. Name.Tag: GREEN_1,
  62. Name.Variable: BLUE_2,
  63. Literal: BLUE_1,
  64. Literal.Date: BLUE_2,
  65. String: BLUE_1,
  66. String.Affix: BLUE_2,
  67. String.Delimiter: BLUE_2,
  68. String.Escape: BLUE_2,
  69. String.Heredoc: BLUE_2,
  70. String.Regex: BLUE_2,
  71. Number: BLUE_1,
  72. Comment: 'italic '+GRAY_3,
  73. Comment.Preproc: "bold " + GRAY_3,
  74. Comment.Special: "bold italic " + GRAY_3,
  75. Operator: 'bold ' + RED_3,
  76. Generic: FG_DEFAULT,
  77. Generic.Deleted: f"bg:{RED_9} {RED_2}",
  78. Generic.Emph: "italic",
  79. Generic.Error: RED_2,
  80. Generic.Heading: "bold "+BLUE_2,
  81. Generic.Inserted: f'bg:{GREEN_7} {GREEN_2}',
  82. Generic.Output: GRAY_3,
  83. Generic.Prompt: GRAY_3,
  84. Generic.Strong: "bold",
  85. Generic.EmphStrong: "bold italic",
  86. Generic.Subheading: BLUE_2,
  87. Generic.Traceback: RED_3,
  88. Generic.Underline: "underline",
  89. Text.Whitespace: FG_SUBTLE,
  90. }