lovelace.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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-2024 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. __all__ = ['LovelaceStyle']
  15. class LovelaceStyle(Style):
  16. """
  17. The style used in Lovelace interactive learning environment. Tries to avoid
  18. the "angry fruit salad" effect with desaturated and dim colours.
  19. """
  20. name = 'lovelace'
  21. _KW_BLUE = '#2838b0'
  22. _NAME_GREEN = '#388038'
  23. _DOC_ORANGE = '#b85820'
  24. _OW_PURPLE = '#a848a8'
  25. _FUN_BROWN = '#785840'
  26. _STR_RED = '#b83838'
  27. _CLS_CYAN = '#287088'
  28. _ESCAPE_LIME = '#709030'
  29. _LABEL_CYAN = '#289870'
  30. _EXCEPT_YELLOW = '#908828'
  31. styles = {
  32. Whitespace: '#a89028',
  33. Comment: 'italic #888888',
  34. Comment.Hashbang: _CLS_CYAN,
  35. Comment.Multiline: '#888888',
  36. Comment.Preproc: 'noitalic '+_LABEL_CYAN,
  37. Keyword: _KW_BLUE,
  38. Keyword.Constant: 'italic #444444',
  39. Keyword.Declaration: 'italic',
  40. Keyword.Type: 'italic',
  41. Operator: '#666666',
  42. Operator.Word: _OW_PURPLE,
  43. Punctuation: '#888888',
  44. Name.Attribute: _NAME_GREEN,
  45. Name.Builtin: _NAME_GREEN,
  46. Name.Builtin.Pseudo: 'italic',
  47. Name.Class: _CLS_CYAN,
  48. Name.Constant: _DOC_ORANGE,
  49. Name.Decorator: _CLS_CYAN,
  50. Name.Entity: _ESCAPE_LIME,
  51. Name.Exception: _EXCEPT_YELLOW,
  52. Name.Function: _FUN_BROWN,
  53. Name.Function.Magic: _DOC_ORANGE,
  54. Name.Label: _LABEL_CYAN,
  55. Name.Namespace: _LABEL_CYAN,
  56. Name.Tag: _KW_BLUE,
  57. Name.Variable: '#b04040',
  58. Name.Variable.Global:_EXCEPT_YELLOW,
  59. Name.Variable.Magic: _DOC_ORANGE,
  60. String: _STR_RED,
  61. String.Affix: '#444444',
  62. String.Char: _OW_PURPLE,
  63. String.Delimiter: _DOC_ORANGE,
  64. String.Doc: 'italic '+_DOC_ORANGE,
  65. String.Escape: _ESCAPE_LIME,
  66. String.Interpol: 'underline',
  67. String.Other: _OW_PURPLE,
  68. String.Regex: _OW_PURPLE,
  69. Number: '#444444',
  70. Generic.Deleted: '#c02828',
  71. Generic.Emph: 'italic',
  72. Generic.Error: '#c02828',
  73. Generic.Heading: '#666666',
  74. Generic.Subheading: '#444444',
  75. Generic.Inserted: _NAME_GREEN,
  76. Generic.Output: '#666666',
  77. Generic.Prompt: '#444444',
  78. Generic.Strong: 'bold',
  79. Generic.EmphStrong: 'bold italic',
  80. Generic.Traceback: _KW_BLUE,
  81. Error: 'bg:'+_OW_PURPLE,
  82. }