Added the ability to export the current color config/theme. (#120)
* Added the ability to export the current color config/theme. * Added the ability to import a theme. * Added the ability to import a config only. * Created preset themes for popular palettes. * Restart AGS once settings/theme is imported. * Added tokyo night theme * Added rose pine themes. * Move themes * Organize files
This commit is contained in:
@@ -6,6 +6,7 @@ import { Variable } from "types/variable";
|
||||
import Wallpaper from "services/Wallpaper";
|
||||
import { dependencies as checkDependencies } from "lib/utils";
|
||||
import options from "options";
|
||||
import { importFiles, saveFileDialog } from "./FileChooser";
|
||||
|
||||
const EnumSetter = (opt: Opt<string>, values: string[]) => {
|
||||
const lbl = Widget.Label({ label: opt.bind().as(v => `${v}`) })
|
||||
@@ -39,12 +40,13 @@ export const Inputter = <T>({
|
||||
increment = 1,
|
||||
disabledBinding,
|
||||
dependencies,
|
||||
exportData,
|
||||
}: RowProps<T>,
|
||||
className: string,
|
||||
isUnsaved: Variable<boolean>
|
||||
) => {
|
||||
return Widget.Box({
|
||||
class_name: "inputter-container",
|
||||
class_name: /export|import/.test(type || "") ? "" : "inputter-container",
|
||||
setup: self => {
|
||||
|
||||
switch (type) {
|
||||
@@ -157,6 +159,25 @@ export const Inputter = <T>({
|
||||
on_file_set: ({ uri }) => { opt.value = uri!.replace("file://", "") as T },
|
||||
})
|
||||
|
||||
case "config_import": return self.child = Widget.Box({
|
||||
children: [
|
||||
Widget.Button({
|
||||
class_name: "options-import",
|
||||
label: "import",
|
||||
on_clicked: () => {
|
||||
importFiles(exportData?.themeOnly as boolean);
|
||||
}
|
||||
}),
|
||||
Widget.Button({
|
||||
class_name: "options-export",
|
||||
label: "export",
|
||||
on_clicked: () => {
|
||||
saveFileDialog(exportData?.filePath as string, exportData?.themeOnly as boolean);
|
||||
}
|
||||
}),
|
||||
]
|
||||
})
|
||||
|
||||
case "wallpaper": return self.child = Widget.FileChooserButton({
|
||||
on_file_set: ({ uri }) => {
|
||||
opt.value = uri!.replace("file://", "") as T;
|
||||
|
||||
Reference in New Issue
Block a user