Skip to content

Commit

Permalink
Convert tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed Apr 6, 2021
1 parent 86835da commit 548ec00
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-style-settings",
"name": "Style Settings",
"version": "0.0.5",
"version": "0.0.6",
"minAppVersion": "0.11.5",
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
"author": "mgmeyers",
Expand Down
31 changes: 18 additions & 13 deletions src/SettingsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "./settingHandlers";
import chroma from "chroma-js";

type VariableKV = Array<{ key: string; value: string }>
type VariableKV = Array<{ key: string; value: string }>;

export type SettingValue = number | string | boolean;

Expand Down Expand Up @@ -46,7 +46,7 @@ function generateColorVariables(
];
case "hsl-values": {
const hsl = parsedColor.hsl();
const alpha = opacity ? `,${parsedColor.alpha()}` : ''
const alpha = opacity ? `,${parsedColor.alpha()}` : "";
return [
{
key,
Expand All @@ -69,12 +69,13 @@ function generateColorVariables(
key: `${key}-l`,
value: (hsl[2] * 100).toString() + "%",
},
]
];

if (opacity) out.push({
key: `${key}-a`,
value: parsedColor.alpha().toString(),
})
if (opacity)
out.push({
key: `${key}-a`,
value: parsedColor.alpha().toString(),
});

return out;
}
Expand All @@ -87,7 +88,7 @@ function generateColorVariables(
];
case "rgb-values": {
const rgb = parsedColor.rgb();
const alpha = opacity ? `,${parsedColor.alpha()}` : ''
const alpha = opacity ? `,${parsedColor.alpha()}` : "";
return [
{
key,
Expand All @@ -112,10 +113,11 @@ function generateColorVariables(
},
];

if (opacity) out.push({
key: `${key}-a`,
value: parsedColor.alpha().toString(),
})
if (opacity)
out.push({
key: `${key}-a`,
value: parsedColor.alpha().toString(),
});

return out;
}
Expand Down Expand Up @@ -228,7 +230,10 @@ export class CSSSettingsManager {
}

setCSSVariables() {
const [vars, themedLight, themedDark] = getCSSVariables(this.settings, this.config);
const [vars, themedLight, themedDark] = getCSSVariables(
this.settings,
this.config
);

this.styleTag.innerText = `
body.css-settings-manager {
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ export default class CSSSettingsPlugin extends Plugin {
if (match && match.length) {
try {
do {
const str = match[1].trim();
const str = match[1].trim().replace(/\t/g, " ");
const settings = parse(str);

if (settings.name && settings.id && settings.settings) {
settingsList.push(settings as ParsedCSSSettings);
}
} while((match = settingRegExp.exec(text)) !== null);
} while ((match = settingRegExp.exec(text)) !== null);
} catch (e) {
console.error("Error parsing style settings: ", e);
}
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"0.0.6": "0.11.5",
"0.0.5": "0.11.5",
"0.0.4": "0.11.5",
"0.0.3": "0.11.5",
Expand Down

0 comments on commit 548ec00

Please sign in to comment.