mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-03 20:14:22 +02:00
Add basic .xrdb/.Xresources import plugin
Adds basic support for importing .Xresources and .xrdb files as Theme resources. Examples of terminal color schemes in .xrdb format can be found here: https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/xrdb Examples of terminal themes in .Xresources format can be found here: https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/Xresources https://terminal.sexy also supports exporting themes is Xresources format.
This commit is contained in:
parent
7b63079594
commit
3e2162d366
11 changed files with 369 additions and 1 deletions
20
test/import_plugins/xrdb/Test1.xrdb
Normal file
20
test/import_plugins/xrdb/Test1.xrdb
Normal file
|
@ -0,0 +1,20 @@
|
|||
#define Background_Color #100000
|
||||
#define Foreground_Color #200000
|
||||
#define Cursor_Color #300000
|
||||
#define Cursor_Text_Color #400000
|
||||
#define Ansi_0_Color #000000
|
||||
#define Ansi_8_Color #000008
|
||||
#define Ansi_1_Color #000001
|
||||
#define Ansi_9_Color #000009
|
||||
#define Ansi_2_Color #000002
|
||||
#define Ansi_10_Color #000010
|
||||
#define Ansi_3_Color #000003
|
||||
#define Ansi_11_Color #000011
|
||||
#define Ansi_4_Color #000004
|
||||
#define Ansi_12_Color #000012
|
||||
#define Ansi_5_Color #000005
|
||||
#define Ansi_13_Color #000013
|
||||
#define Ansi_6_Color #000006
|
||||
#define Ansi_14_Color #000014
|
||||
#define Ansi_7_Color #000007
|
||||
#define Ansi_15_Color #000015
|
13
test/import_plugins/xrdb/Test1.xrdb.import
Normal file
13
test/import_plugins/xrdb/Test1.xrdb.import
Normal file
|
@ -0,0 +1,13 @@
|
|||
[remap]
|
||||
|
||||
importer="godot_xterm_xrdb_importer"
|
||||
type="Theme"
|
||||
path="res://.import/Test1.xrdb-754efb4c644076f3ce42897c010bc001.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/import_plugins/xrdb/Test1.xrdb"
|
||||
dest_files=[ "res://.import/Test1.xrdb-754efb4c644076f3ce42897c010bc001.res" ]
|
||||
|
||||
[params]
|
||||
|
36
test/import_plugins/xrdb/Test2.Xresources
Normal file
36
test/import_plugins/xrdb/Test2.Xresources
Normal file
|
@ -0,0 +1,36 @@
|
|||
! special
|
||||
*.foreground: #c5c8c6
|
||||
*.background: #1d1f21
|
||||
*.cursorColor: #c5c8c6
|
||||
|
||||
! black
|
||||
*.color0: #282a2e
|
||||
*.color8: #373b41
|
||||
|
||||
! red
|
||||
*.color1: #a54242
|
||||
*.color9: #cc6666
|
||||
|
||||
! green
|
||||
*.color2: #8c9440
|
||||
*.color10: #b5bd68
|
||||
|
||||
! yellow
|
||||
*.color3: #de935f
|
||||
*.color11: #f0c674
|
||||
|
||||
! blue
|
||||
*.color4: #5f819d
|
||||
*.color12: #81a2be
|
||||
|
||||
! magenta
|
||||
*.color5: #85678f
|
||||
*.color13: #b294bb
|
||||
|
||||
! cyan
|
||||
*.color6: #5e8d87
|
||||
*.color14: #8abeb7
|
||||
|
||||
! white
|
||||
*.color7: #707880
|
||||
*.color15: #c5c8c6
|
13
test/import_plugins/xrdb/Test2.Xresources.import
Normal file
13
test/import_plugins/xrdb/Test2.Xresources.import
Normal file
|
@ -0,0 +1,13 @@
|
|||
[remap]
|
||||
|
||||
importer="godot_xterm_xrdb_importer"
|
||||
type="Theme"
|
||||
path="res://.import/Test2.Xresources-2344fb3eca84b06f68214bc0cdb6b0ab.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/import_plugins/xrdb/Test2.Xresources"
|
||||
dest_files=[ "res://.import/Test2.Xresources-2344fb3eca84b06f68214bc0cdb6b0ab.res" ]
|
||||
|
||||
[params]
|
||||
|
36
test/import_plugins/xrdb/Test3.xresources
Normal file
36
test/import_plugins/xrdb/Test3.xresources
Normal file
|
@ -0,0 +1,36 @@
|
|||
! special
|
||||
*.foreground: #eddfe4
|
||||
*.background: #000000
|
||||
*.cursorColor: #eddfe4
|
||||
|
||||
! black
|
||||
*.color0: #000000
|
||||
*.color8: #6da3b8
|
||||
|
||||
! red
|
||||
*.color1: #1b0c13
|
||||
*.color9: #ca956c
|
||||
|
||||
! green
|
||||
*.color2: #351b27
|
||||
*.color10: #7ca7b9
|
||||
|
||||
! yellow
|
||||
*.color3: #563042
|
||||
*.color11: #a2c9bc
|
||||
|
||||
! blue
|
||||
*.color4: #814b64
|
||||
*.color12: #9aad72
|
||||
|
||||
! magenta
|
||||
*.color5: #b56b8d
|
||||
*.color13: #82d0b7
|
||||
|
||||
! cyan
|
||||
*.color6: #d0a2b6
|
||||
*.color14: #ae96d0
|
||||
|
||||
! white
|
||||
*.color7: #eddfe4
|
||||
*.color15: #e6bfcf
|
13
test/import_plugins/xrdb/Test3.xresources.import
Normal file
13
test/import_plugins/xrdb/Test3.xresources.import
Normal file
|
@ -0,0 +1,13 @@
|
|||
[remap]
|
||||
|
||||
importer="godot_xterm_xrdb_importer"
|
||||
type="Theme"
|
||||
path="res://.import/Test3.xresources-bec998d839dd0fca9b82fa130c7bada8.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test/import_plugins/xrdb/Test3.xresources"
|
||||
dest_files=[ "res://.import/Test3.xresources-bec998d839dd0fca9b82fa130c7bada8.res" ]
|
||||
|
||||
[params]
|
||||
|
95
test/import_plugins/xrdb/xrdb_import_plugin.test.gd
Normal file
95
test/import_plugins/xrdb/xrdb_import_plugin.test.gd
Normal file
|
@ -0,0 +1,95 @@
|
|||
extends "res://addons/gut/test.gd"
|
||||
# Many themes in a similar format to Test1.xrdb can be found here:
|
||||
# https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/xrdb
|
||||
# Test2.Xresources and Test3.xresources randomly generated at https://terminal.sexy
|
||||
# and downloaded in Xresources format.
|
||||
|
||||
|
||||
func test_xrdb():
|
||||
var theme = preload("./Test1.xrdb")
|
||||
assert_true(theme is Theme)
|
||||
|
||||
var map := {
|
||||
"Black": "#000000",
|
||||
"Red": "#000001",
|
||||
"Green": "#000002",
|
||||
"Yellow": "#000003",
|
||||
"Blue": "#000004",
|
||||
"Magenta": "#000005",
|
||||
"Cyan": "#000006",
|
||||
"Light Grey": "#000007",
|
||||
"Dark Grey": "#000008",
|
||||
"Light Red": "#000009",
|
||||
"Light Green": "#000010",
|
||||
"Light Yellow": "#000011",
|
||||
"Light Blue": "#000012",
|
||||
"Light Magenta": "#000013",
|
||||
"Light Cyan": "#000014",
|
||||
"White": "#000015",
|
||||
"Background": "#100000",
|
||||
"Foreground": "#200000",
|
||||
"Cursor": "#300000",
|
||||
}
|
||||
|
||||
for key in map.keys():
|
||||
assert_eq(theme.get_color(key, "Terminal"), Color(map[key]), key)
|
||||
|
||||
|
||||
func test_Xresources():
|
||||
var theme = preload("./Test2.Xresources")
|
||||
assert_true(theme is Theme)
|
||||
|
||||
var map := {
|
||||
"Black": "#282A2E",
|
||||
"Red": "#A54242",
|
||||
"Green": "#8C9440",
|
||||
"Yellow": "#DE935F",
|
||||
"Blue": "#5F819D",
|
||||
"Magenta": "#85678F",
|
||||
"Cyan": "#5E8D87",
|
||||
"Light Grey": "#707880",
|
||||
"Dark Grey": "#373B41",
|
||||
"Light Red": "#CC6666",
|
||||
"Light Green": "#B5BD68",
|
||||
"Light Yellow": "#F0C674",
|
||||
"Light Blue": "#81A2BE",
|
||||
"Light Magenta": "#B294BB",
|
||||
"Light Cyan": "#8ABEB7",
|
||||
"White": "#C5C8C6",
|
||||
"Background": "#1D1F21",
|
||||
"Foreground": "#C5C8C6",
|
||||
"Cursor": "#C5C8C6",
|
||||
}
|
||||
|
||||
for key in map.keys():
|
||||
assert_eq(theme.get_color(key, "Terminal"), Color(map[key]), key)
|
||||
|
||||
|
||||
func test_xresources():
|
||||
var theme = preload("./Test3.xresources")
|
||||
assert_true(theme is Theme)
|
||||
|
||||
var map := {
|
||||
"Black": "#000000",
|
||||
"Red": "#1B0C13",
|
||||
"Green": "#351B27",
|
||||
"Yellow": "#563042",
|
||||
"Blue": "#814B64",
|
||||
"Magenta": "#B56B8D",
|
||||
"Cyan": "#D0A2B6",
|
||||
"Light Grey": "#EDDFE4",
|
||||
"Dark Grey": "#6DA3B8",
|
||||
"Light Red": "#CA956C",
|
||||
"Light Green": "#7CA7B9",
|
||||
"Light Yellow": "#A2C9BC",
|
||||
"Light Blue": "#9AAD72",
|
||||
"Light Magenta": "#82D0B7",
|
||||
"Light Cyan": "#AE96D0",
|
||||
"White": "#E6BFCF",
|
||||
"Background": "#000000",
|
||||
"Foreground": "#EDDFE4",
|
||||
"Cursor": "#EDDFE4",
|
||||
}
|
||||
|
||||
for key in map.keys():
|
||||
assert_eq(theme.get_color(key, "Terminal"), Color(map[key]), key)
|
Loading…
Add table
Add a link
Reference in a new issue