lovelace.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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-2021 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. default_style = '#222222'
  30. styles = {
  31. Whitespace: '#a89028',
  32. Comment: 'italic #888888',
  33. Comment.Hashbang: _CLS_CYAN,
  34. Comment.Multiline: '#888888',
  35. Comment.Preproc: 'noitalic '+_LABEL_CYAN,
  36. Keyword: _KW_BLUE,
  37. Keyword.Constant: 'italic #444444',
  38. Keyword.Declaration: 'italic',
  39. Keyword.Type: 'italic',
  40. Operator: '#666666',
  41. Operator.Word: _OW_PURPLE,
  42. Punctuation: '#888888',
  43. Name.Attribute: _NAME_GREEN,
  44. Name.Builtin: _NAME_GREEN,
  45. Name.Builtin.Pseudo: 'italic',
  46. Name.Class: _CLS_CYAN,
  47. Name.Constant: _DOC_ORANGE,
  48. Name.Decorator: _CLS_CYAN,
  49. Name.Entity: _ESCAPE_LIME,
  50. Name.Exception: _EXCEPT_YELLOW,
  51. Name.Function: _FUN_BROWN,
  52. Name.Function.Magic: _DOC_ORANGE,
  53. Name.Label: _LABEL_CYAN,
  54. Name.Namespace: _LABEL_CYAN,
  55. Name.Tag: _KW_BLUE,
  56. Name.Variable: '#b04040',
  57. Name.Variable.Global:_EXCEPT_YELLOW,
  58. Name.Variable.Magic: _DOC_ORANGE,
  59. String: _STR_RED,
  60. String.Affix: '#444444',
  61. String.Char: _OW_PURPLE,
  62. String.Delimiter: _DOC_ORANGE,
  63. String.Doc: 'italic '+_DOC_ORANGE,
  64. String.Escape: _ESCAPE_LIME,
  65. String.Interpol: 'underline',
  66. String.Other: _OW_PURPLE,
  67. String.Regex: _OW_PURPLE,
  68. Number: '#444444',
  69. Generic.Deleted: '#c02828',
  70. Generic.Emph: 'italic',
  71. Generic.Error: '#c02828',
  72. Generic.Heading: '#666666',
  73. Generic.Subheading: '#444444',
  74. Generic.Inserted: _NAME_GREEN,
  75. Generic.Output: '#666666',
  76. Generic.Prompt: '#444444',
  77. Generic.Strong: 'bold',
  78. Generic.Traceback: _KW_BLUE,
  79. Error: 'bg:'+_OW_PURPLE,
  80. }