lovelace.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. """
  2. pygments.styles.lovelace
  3. ~~~~~~~~~~~~~~~~~~~~~~~~
  4. Lovelace by Miikka Salminen
  5. Pygments style by Miikka Salminen (https://github.com/miikkas)
  6. A desaturated, somewhat subdued style created for the Lovelace interactive
  7. learning environment.
  8. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
  9. :license: BSD, see LICENSE for details.
  10. """
  11. from pygments.style import Style
  12. from pygments.token import Keyword, Name, Comment, String, Error, \
  13. Number, Operator, Punctuation, Generic, Whitespace
  14. class LovelaceStyle(Style):
  15. """
  16. The style used in Lovelace interactive learning environment. Tries to avoid
  17. the "angry fruit salad" effect with desaturated and dim colours.
  18. """
  19. _KW_BLUE = '#2838b0'
  20. _NAME_GREEN = '#388038'
  21. _DOC_ORANGE = '#b85820'
  22. _OW_PURPLE = '#a848a8'
  23. _FUN_BROWN = '#785840'
  24. _STR_RED = '#b83838'
  25. _CLS_CYAN = '#287088'
  26. _ESCAPE_LIME = '#709030'
  27. _LABEL_CYAN = '#289870'
  28. _EXCEPT_YELLOW = '#908828'
  29. styles = {
  30. Whitespace: '#a89028',
  31. Comment: 'italic #888888',
  32. Comment.Hashbang: _CLS_CYAN,
  33. Comment.Multiline: '#888888',
  34. Comment.Preproc: 'noitalic '+_LABEL_CYAN,
  35. Keyword: _KW_BLUE,
  36. Keyword.Constant: 'italic #444444',
  37. Keyword.Declaration: 'italic',
  38. Keyword.Type: 'italic',
  39. Operator: '#666666',
  40. Operator.Word: _OW_PURPLE,
  41. Punctuation: '#888888',
  42. Name.Attribute: _NAME_GREEN,
  43. Name.Builtin: _NAME_GREEN,
  44. Name.Builtin.Pseudo: 'italic',
  45. Name.Class: _CLS_CYAN,
  46. Name.Constant: _DOC_ORANGE,
  47. Name.Decorator: _CLS_CYAN,
  48. Name.Entity: _ESCAPE_LIME,
  49. Name.Exception: _EXCEPT_YELLOW,
  50. Name.Function: _FUN_BROWN,
  51. Name.Function.Magic: _DOC_ORANGE,
  52. Name.Label: _LABEL_CYAN,
  53. Name.Namespace: _LABEL_CYAN,
  54. Name.Tag: _KW_BLUE,
  55. Name.Variable: '#b04040',
  56. Name.Variable.Global:_EXCEPT_YELLOW,
  57. Name.Variable.Magic: _DOC_ORANGE,
  58. String: _STR_RED,
  59. String.Affix: '#444444',
  60. String.Char: _OW_PURPLE,
  61. String.Delimiter: _DOC_ORANGE,
  62. String.Doc: 'italic '+_DOC_ORANGE,
  63. String.Escape: _ESCAPE_LIME,
  64. String.Interpol: 'underline',
  65. String.Other: _OW_PURPLE,
  66. String.Regex: _OW_PURPLE,
  67. Number: '#444444',
  68. Generic.Deleted: '#c02828',
  69. Generic.Emph: 'italic',
  70. Generic.Error: '#c02828',
  71. Generic.Heading: '#666666',
  72. Generic.Subheading: '#444444',
  73. Generic.Inserted: _NAME_GREEN,
  74. Generic.Output: '#666666',
  75. Generic.Prompt: '#444444',
  76. Generic.Strong: 'bold',
  77. Generic.EmphStrong: 'bold italic',
  78. Generic.Traceback: _KW_BLUE,
  79. Error: 'bg:'+_OW_PURPLE,
  80. }