-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathcolorscheme.go
48 lines (39 loc) · 1.05 KB
/
colorscheme.go
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
// Copyright 2016 The lime Authors.
// Use of this source code is governed by a 2-clause
// BSD-style license that can be found in the LICENSE file.
package backend
import "github.com/limetext/backend/render"
// Any color scheme view should implement this interface
// also it should register it self from editor.AddColorSCheme
type ColorScheme interface {
render.ColourScheme
Name() string
}
type scheme struct {
settings render.Settings
}
func (s *scheme) Spice(*render.ViewRegions) render.Flavour {
return render.Flavour{
Background: s.GlobalSettings().Background,
Foreground: s.GlobalSettings().Foreground,
}
}
func (s *scheme) GlobalSettings() render.Settings {
return s.settings
}
func (s *scheme) Name() string {
return "Plain theme"
}
// default colorscheme used when there is a problem
var colorscheme *scheme
func defaultScheme() ColorScheme {
if colorscheme == nil {
colorscheme = &scheme{
render.Settings{
Background: render.Colour{0, 0, 0, 1},
Foreground: render.Colour{255, 255, 255, 1},
},
}
}
return colorscheme
}