rainbow_dash.py 2.5 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-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 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: 'italic {}'.format(BLUE_LIGHT),
  37. Comment.Preproc: 'noitalic',
  38. Comment.Special: 'bold',
  39. Error: 'bg:{} {}'.format(RED, WHITE),
  40. Generic.Deleted: 'border:{} bg:{}'.format(RED_DARK, RED_LIGHT),
  41. Generic.Emph: 'italic',
  42. Generic.Error: RED_BRIGHT,
  43. Generic.Heading: 'bold {}'.format(BLUE),
  44. Generic.Inserted: 'border:{} bg:{}'.format(GREEN_NEON, GREEN_LIGHT),
  45. Generic.Output: GREY,
  46. Generic.Prompt: 'bold {}'.format(BLUE),
  47. Generic.Strong: 'bold',
  48. Generic.EmphStrong: 'bold italic',
  49. Generic.Subheading: 'bold {}'.format(BLUE),
  50. Generic.Traceback: RED_DARK,
  51. Keyword: 'bold {}'.format(BLUE),
  52. Keyword.Pseudo: 'nobold',
  53. Keyword.Type: PURPLE,
  54. Name.Attribute: 'italic {}'.format(BLUE),
  55. Name.Builtin: 'bold {}'.format(PURPLE),
  56. Name.Class: 'underline',
  57. Name.Constant: TURQUOISE,
  58. Name.Decorator: 'bold {}'.format(ORANGE),
  59. Name.Entity: 'bold {}'.format(PURPLE),
  60. Name.Exception: 'bold {}'.format(PURPLE),
  61. Name.Function: 'bold {}'.format(ORANGE),
  62. Name.Tag: 'bold {}'.format(BLUE),
  63. Number: 'bold {}'.format(PURPLE),
  64. Operator: BLUE,
  65. Operator.Word: 'bold',
  66. String: GREEN,
  67. String.Doc: 'italic',
  68. String.Escape: 'bold {}'.format(RED_DARK),
  69. String.Other: TURQUOISE,
  70. String.Symbol: 'bold {}'.format(RED_DARK),
  71. Text: GREY_DARK,
  72. Whitespace: GREY_LIGHT
  73. }