mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 09:42:10 -04:00
@@ -57,6 +57,7 @@ func init() {
|
|||||||
cmd.Flags().Bool("sync-mode-with-portal", false, "Sync color scheme with GNOME portal")
|
cmd.Flags().Bool("sync-mode-with-portal", false, "Sync color scheme with GNOME portal")
|
||||||
cmd.Flags().Bool("terminals-always-dark", false, "Force terminal themes to dark variant")
|
cmd.Flags().Bool("terminals-always-dark", false, "Force terminal themes to dark variant")
|
||||||
cmd.Flags().String("skip-templates", "", "Comma-separated list of templates to skip")
|
cmd.Flags().String("skip-templates", "", "Comma-separated list of templates to skip")
|
||||||
|
cmd.Flags().Float64("contrast", 0, "Contrast value from -1 to 1 (0 = standard)")
|
||||||
}
|
}
|
||||||
|
|
||||||
matugenQueueCmd.Flags().Bool("wait", true, "Wait for completion")
|
matugenQueueCmd.Flags().Bool("wait", true, "Wait for completion")
|
||||||
@@ -77,6 +78,7 @@ func buildMatugenOptions(cmd *cobra.Command) matugen.Options {
|
|||||||
syncModeWithPortal, _ := cmd.Flags().GetBool("sync-mode-with-portal")
|
syncModeWithPortal, _ := cmd.Flags().GetBool("sync-mode-with-portal")
|
||||||
terminalsAlwaysDark, _ := cmd.Flags().GetBool("terminals-always-dark")
|
terminalsAlwaysDark, _ := cmd.Flags().GetBool("terminals-always-dark")
|
||||||
skipTemplates, _ := cmd.Flags().GetString("skip-templates")
|
skipTemplates, _ := cmd.Flags().GetString("skip-templates")
|
||||||
|
contrast, _ := cmd.Flags().GetFloat64("contrast")
|
||||||
|
|
||||||
return matugen.Options{
|
return matugen.Options{
|
||||||
StateDir: stateDir,
|
StateDir: stateDir,
|
||||||
@@ -87,6 +89,7 @@ func buildMatugenOptions(cmd *cobra.Command) matugen.Options {
|
|||||||
Mode: matugen.ColorMode(mode),
|
Mode: matugen.ColorMode(mode),
|
||||||
IconTheme: iconTheme,
|
IconTheme: iconTheme,
|
||||||
MatugenType: matugenType,
|
MatugenType: matugenType,
|
||||||
|
Contrast: contrast,
|
||||||
RunUserTemplates: runUserTemplates,
|
RunUserTemplates: runUserTemplates,
|
||||||
StockColors: stockColors,
|
StockColors: stockColors,
|
||||||
SyncModeWithPortal: syncModeWithPortal,
|
SyncModeWithPortal: syncModeWithPortal,
|
||||||
@@ -128,6 +131,7 @@ func runMatugenQueue(cmd *cobra.Command, args []string) {
|
|||||||
"syncModeWithPortal": opts.SyncModeWithPortal,
|
"syncModeWithPortal": opts.SyncModeWithPortal,
|
||||||
"terminalsAlwaysDark": opts.TerminalsAlwaysDark,
|
"terminalsAlwaysDark": opts.TerminalsAlwaysDark,
|
||||||
"skipTemplates": opts.SkipTemplates,
|
"skipTemplates": opts.SkipTemplates,
|
||||||
|
"contrast": opts.Contrast,
|
||||||
"wait": wait,
|
"wait": wait,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ type Options struct {
|
|||||||
Mode ColorMode
|
Mode ColorMode
|
||||||
IconTheme string
|
IconTheme string
|
||||||
MatugenType string
|
MatugenType string
|
||||||
|
Contrast float64
|
||||||
RunUserTemplates bool
|
RunUserTemplates bool
|
||||||
ColorsOnly bool
|
ColorsOnly bool
|
||||||
StockColors string
|
StockColors string
|
||||||
@@ -228,6 +229,7 @@ func buildOnce(opts *Options) (bool, error) {
|
|||||||
|
|
||||||
log.Info("Running matugen color hex with stock color overrides")
|
log.Info("Running matugen color hex with stock color overrides")
|
||||||
args := []string{"color", "hex", primaryDark, "-m", string(opts.Mode), "-t", opts.MatugenType, "-c", cfgFile.Name()}
|
args := []string{"color", "hex", primaryDark, "-m", string(opts.Mode), "-t", opts.MatugenType, "-c", cfgFile.Name()}
|
||||||
|
args = appendContrastArg(args, opts.Contrast)
|
||||||
args = append(args, importArgs...)
|
args = append(args, importArgs...)
|
||||||
if err := runMatugen(args); err != nil {
|
if err := runMatugen(args); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -264,6 +266,7 @@ func buildOnce(opts *Options) (bool, error) {
|
|||||||
args = []string{opts.Kind, opts.Value}
|
args = []string{opts.Kind, opts.Value}
|
||||||
}
|
}
|
||||||
args = append(args, "-m", string(opts.Mode), "-t", opts.MatugenType, "-c", cfgFile.Name())
|
args = append(args, "-m", string(opts.Mode), "-t", opts.MatugenType, "-c", cfgFile.Name())
|
||||||
|
args = appendContrastArg(args, opts.Contrast)
|
||||||
args = append(args, importArgs...)
|
args = append(args, importArgs...)
|
||||||
if err := runMatugen(args); err != nil {
|
if err := runMatugen(args); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -299,6 +302,13 @@ func buildOnce(opts *Options) (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendContrastArg(args []string, contrast float64) []string {
|
||||||
|
if contrast == 0 {
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
return append(args, "--contrast", strconv.FormatFloat(contrast, 'f', -1, 64))
|
||||||
|
}
|
||||||
|
|
||||||
func buildMergedConfig(opts *Options, cfgFile *os.File, tmpDir string) error {
|
func buildMergedConfig(opts *Options, cfgFile *os.File, tmpDir string) error {
|
||||||
userConfigPath := filepath.Join(opts.ConfigDir, "matugen", "config.toml")
|
userConfigPath := filepath.Join(opts.ConfigDir, "matugen", "config.toml")
|
||||||
|
|
||||||
@@ -687,6 +697,7 @@ func execDryRun(opts *Options, flags matugenFlags) (string, error) {
|
|||||||
baseArgs = []string{opts.Kind, opts.Value}
|
baseArgs = []string{opts.Kind, opts.Value}
|
||||||
}
|
}
|
||||||
baseArgs = append(baseArgs, "-m", "dark", "-t", opts.MatugenType, "--json", "hex", "--dry-run")
|
baseArgs = append(baseArgs, "-m", "dark", "-t", opts.MatugenType, "--json", "hex", "--dry-run")
|
||||||
|
baseArgs = appendContrastArg(baseArgs, opts.Contrast)
|
||||||
if flags.isV4 {
|
if flags.isV4 {
|
||||||
baseArgs = append(baseArgs, "--source-color-index", "0", "--old-json-output")
|
baseArgs = append(baseArgs, "--source-color-index", "0", "--old-json-output")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ func handleMatugenQueue(conn net.Conn, req models.Request) {
|
|||||||
SyncModeWithPortal: models.GetOr(req, "syncModeWithPortal", false),
|
SyncModeWithPortal: models.GetOr(req, "syncModeWithPortal", false),
|
||||||
TerminalsAlwaysDark: models.GetOr(req, "terminalsAlwaysDark", false),
|
TerminalsAlwaysDark: models.GetOr(req, "terminalsAlwaysDark", false),
|
||||||
SkipTemplates: models.GetOr(req, "skipTemplates", ""),
|
SkipTemplates: models.GetOr(req, "skipTemplates", ""),
|
||||||
|
Contrast: models.GetOr(req, "contrast", 0.0),
|
||||||
}
|
}
|
||||||
|
|
||||||
wait := models.GetOr(req, "wait", true)
|
wait := models.GetOr(req, "wait", true)
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ Singleton {
|
|||||||
property string customThemeFile: ""
|
property string customThemeFile: ""
|
||||||
property var registryThemeVariants: ({})
|
property var registryThemeVariants: ({})
|
||||||
property string matugenScheme: "scheme-tonal-spot"
|
property string matugenScheme: "scheme-tonal-spot"
|
||||||
|
property real matugenContrast: 0
|
||||||
property bool runUserMatugenTemplates: true
|
property bool runUserMatugenTemplates: true
|
||||||
property string matugenTargetMonitor: ""
|
property string matugenTargetMonitor: ""
|
||||||
property real popupTransparency: 1.0
|
property real popupTransparency: 1.0
|
||||||
@@ -484,9 +485,15 @@ Singleton {
|
|||||||
property bool matugenTemplateZed: true
|
property bool matugenTemplateZed: true
|
||||||
|
|
||||||
property var matugenTemplateNeovimSettings: ({
|
property var matugenTemplateNeovimSettings: ({
|
||||||
"dark": { "baseTheme": "github_dark", "harmony": 0.5 },
|
"dark": {
|
||||||
"light": { "baseTheme": "github_light", "harmony": 0.5 }
|
"baseTheme": "github_dark",
|
||||||
})
|
"harmony": 0.5
|
||||||
|
},
|
||||||
|
"light": {
|
||||||
|
"baseTheme": "github_light",
|
||||||
|
"harmony": 0.5
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
property bool showDock: false
|
property bool showDock: false
|
||||||
property bool dockAutoHide: false
|
property bool dockAutoHide: false
|
||||||
@@ -1320,9 +1327,7 @@ Singleton {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
const msg = String(error || "").toLowerCase();
|
const msg = String(error || "").toLowerCase();
|
||||||
return msg.indexOf("file does not exist") !== -1
|
return msg.indexOf("file does not exist") !== -1 || msg.indexOf("no such file") !== -1 || msg.indexOf("enoent") !== -1;
|
||||||
|| msg.indexOf("no such file") !== -1
|
|
||||||
|| msg.indexOf("enoent") !== -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPluginSettings() {
|
function loadPluginSettings() {
|
||||||
@@ -1942,6 +1947,12 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMatugenContrast(value) {
|
||||||
|
if (matugenContrast === value)
|
||||||
|
return;
|
||||||
|
set("matugenContrast", value);
|
||||||
|
}
|
||||||
|
|
||||||
function setRunUserMatugenTemplates(enabled) {
|
function setRunUserMatugenTemplates(enabled) {
|
||||||
if (runUserMatugenTemplates === enabled)
|
if (runUserMatugenTemplates === enabled)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1249,10 +1249,7 @@ Singleton {
|
|||||||
const defaults = themeData.variants.defaults || {};
|
const defaults = themeData.variants.defaults || {};
|
||||||
const modeDefaults = defaults[colorMode] || defaults.dark || {};
|
const modeDefaults = defaults[colorMode] || defaults.dark || {};
|
||||||
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
||||||
const stored = isGreeterMode ?
|
const stored = isGreeterMode ? (GreetdSettings.registryThemeVariants[themeId]?.[colorMode] || modeDefaults) : (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeMultiVariant(themeId, modeDefaults, colorMode) : modeDefaults);
|
||||||
(GreetdSettings.registryThemeVariants[themeId]?.[colorMode] || modeDefaults) :
|
|
||||||
(typeof SettingsData !== "undefined" ?
|
|
||||||
SettingsData.getRegistryThemeMultiVariant(themeId, modeDefaults, colorMode) : modeDefaults);
|
|
||||||
var flavorId = stored.flavor || modeDefaults.flavor || "";
|
var flavorId = stored.flavor || modeDefaults.flavor || "";
|
||||||
const accentId = stored.accent || modeDefaults.accent || "";
|
const accentId = stored.accent || modeDefaults.accent || "";
|
||||||
var flavor = findVariant(themeData.variants.flavors, flavorId);
|
var flavor = findVariant(themeData.variants.flavors, flavorId);
|
||||||
@@ -1279,9 +1276,7 @@ Singleton {
|
|||||||
|
|
||||||
if (themeData.variants.options && themeData.variants.options.length > 0) {
|
if (themeData.variants.options && themeData.variants.options.length > 0) {
|
||||||
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
||||||
const selectedVariantId = isGreeterMode
|
const selectedVariantId = isGreeterMode ? (typeof GreetdSettings.registryThemeVariants[themeId] === "string" ? GreetdSettings.registryThemeVariants[themeId] : themeData.variants.default) : (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeVariant(themeId, themeData.variants.default) : themeData.variants.default);
|
||||||
? (typeof GreetdSettings.registryThemeVariants[themeId] === "string" ? GreetdSettings.registryThemeVariants[themeId] : themeData.variants.default)
|
|
||||||
: (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeVariant(themeId, themeData.variants.default) : themeData.variants.default);
|
|
||||||
const variant = findVariant(themeData.variants.options, selectedVariantId);
|
const variant = findVariant(themeData.variants.options, selectedVariantId);
|
||||||
if (variant) {
|
if (variant) {
|
||||||
const variantColors = variant[colorMode] || variant.dark || variant.light || {};
|
const variantColors = variant[colorMode] || variant.dark || variant.light || {};
|
||||||
@@ -1554,6 +1549,9 @@ Singleton {
|
|||||||
if (typeof SettingsData !== "undefined" && SettingsData.terminalsAlwaysDark) {
|
if (typeof SettingsData !== "undefined" && SettingsData.terminalsAlwaysDark) {
|
||||||
args.push("--terminals-always-dark");
|
args.push("--terminals-always-dark");
|
||||||
}
|
}
|
||||||
|
if (typeof SettingsData !== "undefined" && SettingsData.matugenContrast !== 0) {
|
||||||
|
args.push("--contrast", SettingsData.matugenContrast.toString());
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof SettingsData !== "undefined") {
|
if (typeof SettingsData !== "undefined") {
|
||||||
const skipTemplates = [];
|
const skipTemplates = [];
|
||||||
@@ -1654,12 +1652,8 @@ Singleton {
|
|||||||
const darkDefaults = defaults.dark || {};
|
const darkDefaults = defaults.dark || {};
|
||||||
const lightDefaults = defaults.light || defaults.dark || {};
|
const lightDefaults = defaults.light || defaults.dark || {};
|
||||||
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
||||||
const storedDark = isGreeterMode
|
const storedDark = isGreeterMode ? (GreetdSettings.registryThemeVariants[themeId]?.dark || darkDefaults) : (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeMultiVariant(themeId, darkDefaults, "dark") : darkDefaults);
|
||||||
? (GreetdSettings.registryThemeVariants[themeId]?.dark || darkDefaults)
|
const storedLight = isGreeterMode ? (GreetdSettings.registryThemeVariants[themeId]?.light || lightDefaults) : (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeMultiVariant(themeId, lightDefaults, "light") : lightDefaults);
|
||||||
: (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeMultiVariant(themeId, darkDefaults, "dark") : darkDefaults);
|
|
||||||
const storedLight = isGreeterMode
|
|
||||||
? (GreetdSettings.registryThemeVariants[themeId]?.light || lightDefaults)
|
|
||||||
: (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeMultiVariant(themeId, lightDefaults, "light") : lightDefaults);
|
|
||||||
const darkFlavorId = storedDark.flavor || darkDefaults.flavor || "";
|
const darkFlavorId = storedDark.flavor || darkDefaults.flavor || "";
|
||||||
const lightFlavorId = storedLight.flavor || lightDefaults.flavor || "";
|
const lightFlavorId = storedLight.flavor || lightDefaults.flavor || "";
|
||||||
const accentId = storedDark.accent || darkDefaults.accent || "";
|
const accentId = storedDark.accent || darkDefaults.accent || "";
|
||||||
@@ -1678,9 +1672,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
} else if (customThemeRawData.variants.options) {
|
} else if (customThemeRawData.variants.options) {
|
||||||
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
const isGreeterMode = typeof SessionData !== "undefined" && SessionData.isGreeterMode;
|
||||||
const selectedVariantId = isGreeterMode
|
const selectedVariantId = isGreeterMode ? (typeof GreetdSettings.registryThemeVariants[themeId] === "string" ? GreetdSettings.registryThemeVariants[themeId] : customThemeRawData.variants.default) : (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeVariant(themeId, customThemeRawData.variants.default) : customThemeRawData.variants.default);
|
||||||
? (typeof GreetdSettings.registryThemeVariants[themeId] === "string" ? GreetdSettings.registryThemeVariants[themeId] : customThemeRawData.variants.default)
|
|
||||||
: (typeof SettingsData !== "undefined" ? SettingsData.getRegistryThemeVariant(themeId, customThemeRawData.variants.default) : customThemeRawData.variants.default);
|
|
||||||
const variant = findVariant(customThemeRawData.variants.options, selectedVariantId);
|
const variant = findVariant(customThemeRawData.variants.options, selectedVariantId);
|
||||||
if (variant) {
|
if (variant) {
|
||||||
darkTheme = mergeColors(darkTheme, variant.dark || {});
|
darkTheme = mergeColors(darkTheme, variant.dark || {});
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ var SPEC = {
|
|||||||
customThemeFile: { def: "" },
|
customThemeFile: { def: "" },
|
||||||
registryThemeVariants: { def: {} },
|
registryThemeVariants: { def: {} },
|
||||||
matugenScheme: { def: "scheme-tonal-spot", onChange: "regenSystemThemes" },
|
matugenScheme: { def: "scheme-tonal-spot", onChange: "regenSystemThemes" },
|
||||||
|
matugenContrast: { def: 0, onChange: "regenSystemThemes" },
|
||||||
runUserMatugenTemplates: { def: true, onChange: "regenSystemThemes" },
|
runUserMatugenTemplates: { def: true, onChange: "regenSystemThemes" },
|
||||||
matugenTargetMonitor: { def: "", onChange: "regenSystemThemes" },
|
matugenTargetMonitor: { def: "", onChange: "regenSystemThemes" },
|
||||||
|
|
||||||
@@ -299,10 +300,10 @@ var SPEC = {
|
|||||||
matugenTemplateZed: { def: true },
|
matugenTemplateZed: { def: true },
|
||||||
|
|
||||||
matugenTemplateNeovimSettings: {
|
matugenTemplateNeovimSettings: {
|
||||||
def: {
|
def: {
|
||||||
dark: { baseTheme: "github_dark", harmony: 0.5 },
|
dark: { baseTheme: "github_dark", harmony: 0.5 },
|
||||||
light: { baseTheme: "github_light", harmony: 0.5 }
|
light: { baseTheme: "github_light", harmony: 0.5 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
showDock: { def: false },
|
showDock: { def: false },
|
||||||
|
|||||||
@@ -517,7 +517,24 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
width: parent.width
|
width: parent.width - Theme.spacingM * 2
|
||||||
|
x: Theme.spacingM
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsSliderRow {
|
||||||
|
tab: "theme"
|
||||||
|
tags: ["matugen", "contrast", "dynamic"]
|
||||||
|
settingKey: "matugenContrast"
|
||||||
|
text: I18n.tr("Matugen Contrast")
|
||||||
|
description: I18n.tr("Adjusts contrast of generated colors (-100 = minimum, 0 = standard, 100 = maximum)")
|
||||||
|
value: Math.round(SettingsData.matugenContrast * 100)
|
||||||
|
minimum: -100
|
||||||
|
maximum: 100
|
||||||
|
unit: "%"
|
||||||
|
defaultValue: 0
|
||||||
|
enabled: Theme.matugenAvailable
|
||||||
|
opacity: enabled ? 1 : 0.4
|
||||||
|
onSliderDragFinished: finalValue => SettingsData.setMatugenContrast(finalValue / 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user