Skip to content

Commit

Permalink
Add opacity flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus64 committed Jan 1, 2023
1 parent 1bdb941 commit 615fe46
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ juice.exe
deno.lock
dist.zip
juice*
backup*
33 changes: 18 additions & 15 deletions example-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,65 +264,68 @@
"padding": "6"
},
{
"backgroundImage": "r2d2.png",
"backgroundImage": "creeper.jpg",
"backgroundImageAlignment": "center",
"backgroundImageOpacity": 0.23,
"backgroundImageStretchMode": "uniformToFill",
"closeOnExit": "always",
"colorScheme": "Dracula",
"cursorShape": "filledBox",
"cursorShape": "bar",
"experimental.retroTerminalEffect": false,
"font": {
"face": "CaskaydiaCove Nerd Font",
"size": 15
"face": "Minecraft Font",
"size": 16
},
"guid": "{5cfb588f-2b1d-4619-7de2-1d9d45c5aaf9}",
"hidden": false,
"icon": "ubuntu.png",
"name": "Ubuntu-20.04",
"opacity": 100,
"padding": "8",
"padding": "6",
"startingDirectory": "\\Ubuntu-20.04\\home\\",
"tabTitle": null,
"useAcrylic": false
},
{
"backgroundImage": "darthMinimalist.jpg",
"backgroundImage": "creeper.jpg",
"backgroundImageAlignment": "center",
"backgroundImageOpacity": 0.25,
"backgroundImageStretchMode": "uniformToFill",
"closeOnExit": "always",
"colorScheme": "Galaxy",
"colorScheme": "Dracula",
"commandline": "bash.exe",
"cursorShape": "filledBox",
"cursorShape": "bar",
"experimental.retroTerminalEffect": false,
"font": {
"face": "FiraCode Nerd Font Mono",
"size": 13
"face": "Minecraft Font",
"size": 16
},
"guid": "{4c546d3a-3323-4d49-a126-7a793a82a45e}",
"hidden": false,
"icon": "git-for-windows.ico",
"name": "Git bash",
"opacity": 100,
"startingDirectory": "%USERPROFILE%",
"useAcrylic": false
"useAcrylic": false,
"padding": "6"
},
{
"backgroundImage": "arsh.jpg",
"backgroundImage": "creeper.jpg",
"backgroundImageAlignment": "top",
"closeOnExit": "always",
"colorScheme": "Dracula",
"cursorShape": "filledBox",
"cursorShape": "bar",
"experimental.retroTerminalEffect": false,
"font": {
"face": "Cascadia Code"
"face": "Minecraft Font",
"size": 16
},
"guid": "{9caa0dad-45ba-5f56-a8ff-afceeeaa6101}",
"hidden": false,
"name": "Simbolo del sistema",
"opacity": 52,
"useAcrylic": true
"useAcrylic": true,
"padding": "6"
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions src/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ interface layoutFlags {
cursor?: Cursor;
p?: string;
padding?: string;
o?: number;
opacity?: number;
}

interface imageFlags {
Expand Down Expand Up @@ -47,6 +49,7 @@ const help = ["help", "h"];
const cursor = ["cursor", "c"];
const padding = ["padding", "p"];
const version = ["version", "v"];
const opacity = ["opacity", "o"];

export const getFlags = async () => {
let flags: Flags = parse(Deno.args, {
Expand All @@ -58,6 +61,7 @@ export const getFlags = async () => {
...scheme,
...cursor,
...padding,
...opacity
],
});

Expand Down Expand Up @@ -94,6 +98,7 @@ const getProfileFlags = async (flags: Flags) => {
flags.fontSize = profile.font?.size ?? flags.fontSize;
flags.scheme = profile.colorScheme ?? flags.scheme;
flags.padding = profile.padding ?? flags.padding;
flags.opacity = profile.opacity ?? flags.opacity;

return flags;
};
3 changes: 2 additions & 1 deletion src/help.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { blue, cyan, green, reset, yellow } from "colors";
const version = "0.3.2";
const version = "0.3.3";

export const showVersion = () => {
console.log(`juice ${version}`);
Expand All @@ -24,6 +24,7 @@ export const showHelp = () => {
console.log(` --fontSize -z ${yellow("Set font size")}`);
console.log(` --cursor -c ${yellow("Set cursor style")}`);
console.log(` --padding -p ${yellow("Set padding")}`);
console.log(` --opacity -o ${yellow("Set opacity")}`);

return;
};
5 changes: 5 additions & 0 deletions src/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export const changeProfileValues = (profile: Profile, flags: Flags) => {
profile.cursorShape = cursor;
}

if (flags.o || flags.opacity) {
const opacity = flags.o ?? flags.opacity;
profile.opacity = Number(opacity);
}

return profile;
} catch (err) {
throw new Error(err);
Expand Down

0 comments on commit 615fe46

Please sign in to comment.