rainbow_dash.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. """
  2. pygments.styles.rainbow_dash
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. A bright and colorful syntax highlighting `theme`.
  5. .. _theme: http://sanssecours.github.io/Rainbow-Dash.tmbundle
  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 Comment, Error, Generic, Name, Number, Operator, \
  11. String, Text, Whitespace, Keyword
  12. __all__ = ['RainbowDashStyle']
  13. BLUE_LIGHT = '#0080ff'
  14. BLUE = '#2c5dcd'
  15. GREEN = '#00cc66'
  16. GREEN_LIGHT = '#ccffcc'
  17. GREEN_NEON = '#00cc00'
  18. GREY = '#aaaaaa'
  19. GREY_LIGHT = '#cbcbcb'
  20. GREY_DARK = '#4d4d4d'
  21. PURPLE = '#5918bb'
  22. RED = '#cc0000'
  23. RED_DARK = '#c5060b'
  24. RED_LIGHT = '#ffcccc'
  25. RED_BRIGHT = '#ff0000'
  26. WHITE = '#ffffff'
  27. TURQUOISE = '#318495'
  28. ORANGE = '#ff8000'
  29. class RainbowDashStyle(Style):
  30. """
  31. A bright and colorful syntax highlighting theme.
  32. """
  33. name = 'rainbow_dash'
  34. background_color = WHITE
  35. styles = {
  36. Comment: f'italic {BLUE_LIGHT}',
  37. Comment.Preproc: 'noitalic',
  38. Comment.Special: 'bold',
  39. Error: f'bg:{RED} {WHITE}',
  40. Generic.Deleted: f'border:{RED_DARK} bg:{RED_LIGHT}',
  41. Generic.Emph: 'italic',
  42. Generic.Error: RED_BRIGHT,
  43. Generic.Heading: f'bold {BLUE}',
  44. Generic.Inserted: f'border:{GREEN_NEON} bg:{GREEN_LIGHT}',
  45. Generic.Output: GREY,
  46. Generic.Prompt: f'bold {BLUE}',
  47. Generic.Strong: 'bold',
  48. Generic.EmphStrong: 'bold italic',
  49. Generic.Subheading: f'bold {BLUE}',
  50. Generic.Traceback: RED_DARK,
  51. Keyword: f'bold {BLUE}',
  52. Keyword.Pseudo: 'nobold',
  53. Keyword.Type: PURPLE,
  54. Name.Attribute: f'italic {BLUE}',
  55. Name.Builtin: f'bold {PURPLE}',
  56. Name.Class: 'underline',
  57. Name.Constant: TURQUOISE,
  58. Name.Decorator: f'bold {ORANGE}',
  59. Name.Entity: f'bold {PURPLE}',
  60. Name.Exception: f'bold {PURPLE}',
  61. Name.Function: f'bold {ORANGE}',
  62. Name.Tag: f'bold {BLUE}',
  63. Number: f'bold {PURPLE}',
  64. Operator: BLUE,
  65. Operator.Word: 'bold',
  66. String: GREEN,
  67. String.Doc: 'italic',
  68. String.Escape: f'bold {RED_DARK}',
  69. String.Other: TURQUOISE,
  70. String.Symbol: f'bold {RED_DARK}',
  71. Text: GREY_DARK,
  72. Whitespace: GREY_LIGHT
  73. }