summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/rouge-4.5.2/lib/rouge/themes/gruvbox.rb
blob: 8faf4cc5f6dd93e6722277bfea50288318f9b0eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

# TODO how are we going to handle soft/hard contrast?

module Rouge
  module Themes
    # Based on https://github.com/morhetz/gruvbox, with help from
    # https://github.com/daveyarwood/gruvbox-pygments
    class Gruvbox < CSSTheme
      name 'gruvbox'

      # global Gruvbox colours {{{
      C_dark0_hard = '#1d2021'
      C_dark0 ='#282828'
      C_dark0_soft = '#32302f'
      C_dark1 = '#3c3836'
      C_dark2 = '#504945'
      C_dark3 = '#665c54'
      C_dark4 = '#7c6f64'
      C_dark4_256 = '#7c6f64'

      C_gray_245 = '#928374'
      C_gray_244 = '#928374'

      C_light0_hard = '#f9f5d7'
      C_light0 = '#fbf1c7'
      C_light0_soft = '#f2e5bc'
      C_light1 = '#ebdbb2'
      C_light2 = '#d5c4a1'
      C_light3 = '#bdae93'
      C_light4 = '#a89984'
      C_light4_256 = '#a89984'

      C_bright_red = '#fb4934'
      C_bright_green = '#b8bb26'
      C_bright_yellow = '#fabd2f'
      C_bright_blue = '#83a598'
      C_bright_purple = '#d3869b'
      C_bright_aqua = '#8ec07c'
      C_bright_orange = '#fe8019'

      C_neutral_red = '#cc241d'
      C_neutral_green = '#98971a'
      C_neutral_yellow = '#d79921'
      C_neutral_blue = '#458588'
      C_neutral_purple = '#b16286'
      C_neutral_aqua = '#689d6a'
      C_neutral_orange = '#d65d0e'

      C_faded_red = '#9d0006'
      C_faded_green = '#79740e'
      C_faded_yellow = '#b57614'
      C_faded_blue = '#076678'
      C_faded_purple = '#8f3f71'
      C_faded_aqua = '#427b58'
      C_faded_orange = '#af3a03'
      # }}}

      extend HasModes

      def self.light!
        mode :dark # indicate that there is a dark variant
        mode! :light
      end

      def self.dark!
        mode :light # indicate that there is a light variant
        mode! :dark
      end

      def self.make_dark!
        palette bg0: C_dark0
        palette bg1: C_dark1
        palette bg2: C_dark2
        palette bg3: C_dark3
        palette bg4: C_dark4

        palette gray: C_gray_245

        palette fg0: C_light0
        palette fg1: C_light1
        palette fg2: C_light2
        palette fg3: C_light3
        palette fg4: C_light4

        palette fg4_256: C_light4_256

        palette red: C_bright_red
        palette green: C_bright_green
        palette yellow: C_bright_yellow
        palette blue: C_bright_blue
        palette purple: C_bright_purple
        palette aqua: C_bright_aqua
        palette orange: C_bright_orange

      end

      def self.make_light!
        palette bg0: C_light0
        palette bg1: C_light1
        palette bg2: C_light2
        palette bg3: C_light3
        palette bg4: C_light4

        palette gray: C_gray_244

        palette fg0: C_dark0
        palette fg1: C_dark1
        palette fg2: C_dark2
        palette fg3: C_dark3
        palette fg4: C_dark4

        palette fg4_256: C_dark4_256

        palette red: C_faded_red
        palette green: C_faded_green
        palette yellow: C_faded_yellow
        palette blue: C_faded_blue
        palette purple: C_faded_purple
        palette aqua: C_faded_aqua
        palette orange: C_faded_orange
      end

      dark!
      mode :light

      style Text, :fg => :fg0, :bg => :bg0
      style Error, :fg => :red, :bg => :bg0, :bold => true
      style Comment, :fg => :gray, :italic => true

      style Comment::Preproc, :fg => :aqua

      style Name::Tag, :fg => :red

      style Operator,
            Punctuation, :fg => :fg0

      style Generic::Inserted, :fg => :green, :bg => :bg0
      style Generic::Deleted, :fg => :red, :bg => :bg0
      style Generic::Heading, :fg => :green, :bold => true

      style Generic::Emph, :italic => true
      style Generic::EmphStrong, :italic => true, :bold => true
      style Generic::Strong, :bold => true

      style Keyword, :fg => :red
      style Keyword::Constant, :fg => :purple
      style Keyword::Type, :fg => :yellow

      style Keyword::Declaration, :fg => :orange

      style Literal::String,
            Literal::String::Interpol,
            Literal::String::Regex, :fg => :green, :italic => true

      style Literal::String::Affix, :fg => :red

      style Literal::String::Escape, :fg => :orange

      style Name::Namespace,
            Name::Class, :fg => :aqua

      style Name::Constant, :fg => :purple

      style Name::Attribute, :fg => :green

      style Literal::Number, :fg => :purple

      style Literal::String::Symbol, :fg => :blue
    end
  end
end