add support for different background colors
This commit is contained in:
parent
30b9300441
commit
1c6998d5f5
@ -28,7 +28,12 @@ public extension Theme {
|
||||
.property : Color(red: 0.13, green: 0.67, blue: 0.62),
|
||||
.dotAccess : Color(red: 0.57, green: 0.7, blue: 0),
|
||||
.preprocessing : Color(red: 0.71, green: 0.54, blue: 0)
|
||||
]
|
||||
],
|
||||
backgroundColor: Color(
|
||||
red: 0.098,
|
||||
green: 0.098,
|
||||
blue: 0.098
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -51,7 +56,12 @@ public extension Theme {
|
||||
.property : Color(red: 0.431, green: 0.714, blue: 0.533),
|
||||
.dotAccess : Color(red: 0.431, green: 0.714, blue: 0.533),
|
||||
.preprocessing : Color(red: 0.896, green: 0.488, blue: 0.284)
|
||||
]
|
||||
],
|
||||
backgroundColor: Color(
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -74,7 +84,12 @@ public extension Theme {
|
||||
.property : Color(red: 0.431, green: 0.714, blue: 0.533),
|
||||
.dotAccess : Color(red: 0.431, green: 0.714, blue: 0.533),
|
||||
.preprocessing : Color(red: 0.992, green: 0.791, blue: 0.45)
|
||||
]
|
||||
],
|
||||
backgroundColor: Color(
|
||||
red:0.18,
|
||||
green:0.19,
|
||||
blue:0.20
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -97,7 +112,12 @@ public extension Theme {
|
||||
.property : Color(red: 0.584, green: 0.898, blue: 0.361),
|
||||
.dotAccess : Color(red: 0.584, green: 0.898, blue: 0.361),
|
||||
.preprocessing : Color(red: 0.952, green: 0.526, blue: 0.229)
|
||||
]
|
||||
],
|
||||
backgroundColor: Color(
|
||||
red: 0.163,
|
||||
green: 0.163,
|
||||
blue: 0.182
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -120,7 +140,12 @@ public extension Theme {
|
||||
.property : Color(red: 0.278, green: 0.415, blue: 0.593),
|
||||
.dotAccess : Color(red: 0.278, green: 0.415, blue: 0.593),
|
||||
.preprocessing : Color(red: 0.392, green: 0.391, blue: 0.52)
|
||||
]
|
||||
],
|
||||
backgroundColor: Color(
|
||||
red:1.00,
|
||||
green:0.99,
|
||||
blue:0.90
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -143,7 +168,12 @@ public extension Theme {
|
||||
.property : Color(red: 0.267, green: 0.537, blue: 0.576),
|
||||
.dotAccess : Color(red: 0.267, green: 0.537, blue: 0.576),
|
||||
.preprocessing : Color(red: 0.431, green: 0.125, blue: 0.051)
|
||||
]
|
||||
],
|
||||
backgroundColor: Color(
|
||||
red:1.0,
|
||||
green:1.0,
|
||||
blue:1.0
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,16 @@ public struct Theme {
|
||||
public var font: Font
|
||||
/// What color to use for plain text (no highlighting)
|
||||
public var plainTextColor: Color
|
||||
/// What color to use for background
|
||||
public var backgroundColor: Color
|
||||
/// What color to use for the text's highlighted tokens
|
||||
public var tokenColors: [TokenType : Color]
|
||||
|
||||
public init(font: Font, plainTextColor: Color, tokenColors: [TokenType : Color]) {
|
||||
public init(font: Font, plainTextColor: Color, tokenColors: [TokenType : Color], backgroundColor:Color = Color(white: 0.12, alpha: 1)) {
|
||||
self.font = font
|
||||
self.plainTextColor = plainTextColor
|
||||
self.tokenColors = tokenColors
|
||||
self.backgroundColor = backgroundColor
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,7 @@ let contextRect = CGRect(
|
||||
let context = NSGraphicsContext(size: contextRect.size)
|
||||
NSGraphicsContext.current = context
|
||||
|
||||
let backgroundColor = NSColor(white: 0.12, alpha: 1)
|
||||
context.fill(with: backgroundColor, in: contextRect)
|
||||
context.fill(with: theme.backgroundColor, in: contextRect)
|
||||
|
||||
string.draw(in: CGRect(
|
||||
x: options.padding,
|
||||
|
Loading…
x
Reference in New Issue
Block a user