lovelace.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # -*- coding: utf-8 -*-
  2. """
  3. pygments.styles.lovelace
  4. ~~~~~~~~~~~~~~~~~~~~~~~~
  5. Lovelace by Miikka Salminen
  6. Pygments style by Miikka Salminen (https://github.com/miikkas)
  7. A desaturated, somewhat subdued style created for the Lovelace interactive
  8. learning environment.
  9. :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
  10. :license: BSD, see LICENSE for details.
  11. """
  12. from pygments.style import Style
  13. from pygments.token import Keyword, Name, Comment, String, Error, \
  14. Number, Operator, Punctuation, Generic, Whitespace
  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. _KW_BLUE = '#2838b0'
  21. _NAME_GREEN = '#388038'
  22. _DOC_ORANGE = '#b85820'
  23. _OW_PURPLE = '#a848a8'
  24. _FUN_BROWN = '#785840'
  25. _STR_RED = '#b83838'
  26. _CLS_CYAN = '#287088'
  27. _ESCAPE_LIME = '#709030'
  28. _LABEL_CYAN = '#289870'
  29. _EXCEPT_YELLOW = '#908828'
  30. default_style = '#222222'
  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.Traceback: _KW_BLUE,
  80. Error: 'bg:'+_OW_PURPLE,
  81. }