rainbow_dash.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # -*- coding: utf-8 -*-
  2. """
  3. pygments.styles.rainbow_dash
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. A bright and colorful syntax highlighting `theme`.
  6. .. _theme: http://sanssecours.github.io/Rainbow-Dash.tmbundle
  7. :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
  8. :license: BSD, see LICENSE for details.
  9. """
  10. from pygments.style import Style
  11. from pygments.token import (Comment, Error, Generic, Name, Number, Operator,
  12. String, Text, Whitespace, Keyword)
  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. background_color = WHITE
  34. styles = {
  35. Comment: 'italic {}'.format(BLUE_LIGHT),
  36. Comment.Preproc: 'noitalic',
  37. Comment.Special: 'bold',
  38. Error: 'bg:{} {}'.format(RED, WHITE),
  39. Generic.Deleted: 'border:{} bg:{}'.format(RED_DARK, RED_LIGHT),
  40. Generic.Emph: 'italic',
  41. Generic.Error: RED_BRIGHT,
  42. Generic.Heading: 'bold {}'.format(BLUE),
  43. Generic.Inserted: 'border:{} bg:{}'.format(GREEN_NEON, GREEN_LIGHT),
  44. Generic.Output: GREY,
  45. Generic.Prompt: 'bold {}'.format(BLUE),
  46. Generic.Strong: 'bold',
  47. Generic.Subheading: 'bold {}'.format(BLUE),
  48. Generic.Traceback: RED_DARK,
  49. Keyword: 'bold {}'.format(BLUE),
  50. Keyword.Pseudo: 'nobold',
  51. Keyword.Type: PURPLE,
  52. Name.Attribute: 'italic {}'.format(BLUE),
  53. Name.Builtin: 'bold {}'.format(PURPLE),
  54. Name.Class: 'underline',
  55. Name.Constant: TURQUOISE,
  56. Name.Decorator: 'bold {}'.format(ORANGE),
  57. Name.Entity: 'bold {}'.format(PURPLE),
  58. Name.Exception: 'bold {}'.format(PURPLE),
  59. Name.Function: 'bold {}'.format(ORANGE),
  60. Name.Tag: 'bold {}'.format(BLUE),
  61. Number: 'bold {}'.format(PURPLE),
  62. Operator: BLUE,
  63. Operator.Word: 'bold',
  64. String: GREEN,
  65. String.Doc: 'italic',
  66. String.Escape: 'bold {}'.format(RED_DARK),
  67. String.Other: TURQUOISE,
  68. String.Symbol: 'bold {}'.format(RED_DARK),
  69. Text: GREY_DARK,
  70. Whitespace: GREY_LIGHT
  71. }