gh_dark.py 3.4 KB

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