mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 21:36:17 +00:00
updated themeeditor to work with teh background color
added suiColor as a get/set property on colorcodable trying to fix the wierd jumpiness when shaking the color in the green bit trying to fix the wierd drift when increasing the "brightness" savethemes will clear themes before starting to append updated updatetheme to savethemes aswell modified: ShhShell/Host/HostsManager.swift modified: ShhShell/Themes/ColorCodable.swift modified: ShhShell/Themes/ThemeCodable.swift modified: ShhShell/Views/Themes/ThemeEditorView.swift
This commit is contained in:
@@ -38,17 +38,27 @@ struct ColorCodable: Codable, Hashable, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ColorCodable {
|
||||
var suiColor: SwiftUI.Color {
|
||||
get {
|
||||
let red = CGFloat(self.red)
|
||||
let green = CGFloat(self.green)
|
||||
let blue = CGFloat(self.blue)
|
||||
return Color(UIColor(red: red, green: green, blue: blue, alpha: 1))
|
||||
}
|
||||
set {
|
||||
let cc = ColorCodable(color: newValue)
|
||||
self.red = cc.red
|
||||
self.green = cc.green
|
||||
self.blue = cc.blue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension ColorCodable {
|
||||
var stColor: SwiftTerm.Color {
|
||||
return SwiftTerm.Color(self)
|
||||
}
|
||||
|
||||
var suiColor: SwiftUI.Color {
|
||||
let red = CGFloat(self.red)/65535
|
||||
let green = CGFloat(self.green)/65535
|
||||
let blue = CGFloat(self.blue)/65535
|
||||
return Color(UIColor(red: red, green: green, blue: blue, alpha: 1))
|
||||
}
|
||||
}
|
||||
|
||||
extension SwiftTerm.Color {
|
||||
|
||||
@@ -113,23 +113,72 @@ extension ThemeCodable {
|
||||
}
|
||||
}
|
||||
set {
|
||||
let cc = ColorCodable(color: newValue)
|
||||
switch index {
|
||||
case 0: ansi0 = ColorCodable(color: newValue)
|
||||
case 1: ansi1 = ColorCodable(color: newValue)
|
||||
case 2: ansi2 = ColorCodable(color: newValue)
|
||||
case 3: ansi3 = ColorCodable(color: newValue)
|
||||
case 4: ansi4 = ColorCodable(color: newValue)
|
||||
case 5: ansi5 = ColorCodable(color: newValue)
|
||||
case 6: ansi6 = ColorCodable(color: newValue)
|
||||
case 7: ansi7 = ColorCodable(color: newValue)
|
||||
case 8: ansi8 = ColorCodable(color: newValue)
|
||||
case 9: ansi9 = ColorCodable(color: newValue)
|
||||
case 10: ansi10 = ColorCodable(color: newValue)
|
||||
case 11: ansi11 = ColorCodable(color: newValue)
|
||||
case 12: ansi12 = ColorCodable(color: newValue)
|
||||
case 13: ansi13 = ColorCodable(color: newValue)
|
||||
case 14: ansi14 = ColorCodable(color: newValue)
|
||||
case 15: ansi15 = ColorCodable(color: newValue)
|
||||
case 0:
|
||||
ansi0.red = cc.red
|
||||
ansi0.green = cc.green
|
||||
ansi0.blue = cc.blue
|
||||
case 1:
|
||||
ansi1.red = cc.red
|
||||
ansi1.green = cc.green
|
||||
ansi1.blue = cc.blue
|
||||
case 2:
|
||||
ansi2.red = cc.red
|
||||
ansi2.green = cc.green
|
||||
ansi2.blue = cc.blue
|
||||
case 3:
|
||||
ansi3.red = cc.red
|
||||
ansi3.green = cc.green
|
||||
ansi3.blue = cc.blue
|
||||
case 4:
|
||||
ansi4.red = cc.red
|
||||
ansi4.green = cc.green
|
||||
ansi4.blue = cc.blue
|
||||
case 5:
|
||||
ansi5.red = cc.red
|
||||
ansi5.green = cc.green
|
||||
ansi5.blue = cc.blue
|
||||
case 6:
|
||||
ansi6.red = cc.red
|
||||
ansi6.green = cc.green
|
||||
ansi6.blue = cc.blue
|
||||
case 7:
|
||||
ansi7.red = cc.red
|
||||
ansi7.green = cc.green
|
||||
ansi7.blue = cc.blue
|
||||
case 8:
|
||||
ansi8.red = cc.red
|
||||
ansi8.green = cc.green
|
||||
ansi8.blue = cc.blue
|
||||
case 9:
|
||||
ansi9.red = cc.red
|
||||
ansi9.green = cc.green
|
||||
ansi9.blue = cc.blue
|
||||
case 10:
|
||||
ansi10.red = cc.red
|
||||
ansi10.green = cc.green
|
||||
ansi10.blue = cc.blue
|
||||
case 11:
|
||||
ansi11.red = cc.red
|
||||
ansi11.green = cc.green
|
||||
ansi11.blue = cc.blue
|
||||
case 12:
|
||||
ansi12.red = cc.red
|
||||
ansi12.green = cc.green
|
||||
ansi12.blue = cc.blue
|
||||
case 13:
|
||||
ansi13.red = cc.red
|
||||
ansi13.green = cc.green
|
||||
ansi13.blue = cc.blue
|
||||
case 14:
|
||||
ansi14.red = cc.red
|
||||
ansi14.green = cc.green
|
||||
ansi14.blue = cc.blue
|
||||
case 15:
|
||||
ansi15.red = cc.red
|
||||
ansi15.green = cc.green
|
||||
ansi15.blue = cc.blue
|
||||
default: fatalError()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user