rainbow_dash.py 2.4 KB

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