add theme support
This commit is contained in:
parent
a5cb3cbb9e
commit
a2afb77cea
2 changed files with 32 additions and 14 deletions
40
action.ts
40
action.ts
|
@ -1,5 +1,6 @@
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
import themes from './themes/themes.json'
|
||||||
import { fetchProfile, fetchTopLanguages, fetchHistory } from "./src/fetcher";
|
import { fetchProfile, fetchTopLanguages, fetchHistory } from "./src/fetcher";
|
||||||
import ProfileCard from "./src/cards/ProfileCard";
|
import ProfileCard from "./src/cards/ProfileCard";
|
||||||
import TopLanguagesCard from "./src/cards/TopLanguagesCard";
|
import TopLanguagesCard from "./src/cards/TopLanguagesCard";
|
||||||
|
@ -28,16 +29,20 @@ async function main() {
|
||||||
const profilecard = ReactDOMServer.renderToStaticMarkup(
|
const profilecard = ReactDOMServer.renderToStaticMarkup(
|
||||||
new ProfileCard(profile.username, profile.xp, profile.recentXp, {
|
new ProfileCard(profile.username, profile.xp, profile.recentXp, {
|
||||||
hide: parseArray(core.getInput("profile_card_hide_lines")),
|
hide: parseArray(core.getInput("profile_card_hide_lines")),
|
||||||
show_icons: parseBoolean(core.getInput("profile_card_show_icons")),
|
show_icons: core.getBooleanInput("profile_card_show_icons"),
|
||||||
hide_rank: parseBoolean(core.getInput("profile_card_hide_rank")),
|
hide_rank: core.getBooleanInput("profile_card_hide_rank"),
|
||||||
line_height: parseNumber(core.getInput("profile_card_line_height")),
|
line_height: parseNumber(core.getInput("profile_card_line_height")),
|
||||||
title: core.getInput("profile_card_title"),
|
title: core.getInput("profile_card_title"),
|
||||||
title_color: core.getInput("common_title_color"),
|
title_color: core.getInput("common_title_color"),
|
||||||
icon_color: core.getInput("common_icon_color"),
|
icon_color: core.getInput("common_icon_color"),
|
||||||
text_color: core.getInput("common_text_color"),
|
text_color: core.getInput("common_text_color"),
|
||||||
bg_color: core.getInput("common_bg_color"),
|
bg_color: core.getInput("common_bg_color"),
|
||||||
hide_title: parseBoolean(core.getInput("common_hide_title")),
|
hide_title: core.getBooleanInput("common_hide_title"),
|
||||||
hide_border: parseBoolean(core.getInput("common_hide_border")),
|
hide_border: core.getBooleanInput("common_hide_border"),
|
||||||
|
theme:
|
||||||
|
core.getInput("theme") in themes
|
||||||
|
? (core.getInput("theme") as keyof typeof themes)
|
||||||
|
: "default",
|
||||||
}).render()
|
}).render()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -52,15 +57,19 @@ async function main() {
|
||||||
core.getInput("toplangs_card_language_count")
|
core.getInput("toplangs_card_language_count")
|
||||||
),
|
),
|
||||||
card_width: 500,
|
card_width: 500,
|
||||||
layout: parseBoolean(core.getInput("toplangs_card_compact_layout"))
|
layout: core.getBooleanInput("toplangs_card_compact_layout")
|
||||||
? "compact"
|
? "compact"
|
||||||
: undefined,
|
: undefined,
|
||||||
title: core.getInput("toplangs_card_title"),
|
title: core.getInput("toplangs_card_title"),
|
||||||
title_color: core.getInput("common_title_color"),
|
title_color: core.getInput("common_title_color"),
|
||||||
text_color: core.getInput("common_text_color"),
|
text_color: core.getInput("common_text_color"),
|
||||||
bg_color: core.getInput("common_bg_color"),
|
bg_color: core.getInput("common_bg_color"),
|
||||||
hide_title: parseBoolean(core.getInput("common_hide_title")),
|
hide_title: core.getBooleanInput("common_hide_title"),
|
||||||
hide_border: parseBoolean(core.getInput("common_hide_border")),
|
hide_border: core.getBooleanInput("common_hide_border"),
|
||||||
|
theme:
|
||||||
|
core.getInput("theme") in themes
|
||||||
|
? (core.getInput("theme") as keyof typeof themes)
|
||||||
|
: "default",
|
||||||
}).render()
|
}).render()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -74,20 +83,23 @@ async function main() {
|
||||||
language_count: parseNumber(
|
language_count: parseNumber(
|
||||||
core.getInput("history_card_language_count")
|
core.getInput("history_card_language_count")
|
||||||
),
|
),
|
||||||
hide_legend: parseBoolean(core.getInput("history_card_hide_legend")),
|
hide_legend: core.getBooleanInput("history_card_hide_legend"),
|
||||||
reverse_order: parseBoolean(
|
reverse_order: core.getBooleanInput("history_card_reverse_order")
|
||||||
core.getInput("history_card_reverse_order")
|
,
|
||||||
),
|
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 300,
|
height: 300,
|
||||||
title_color: core.getInput("common_title_color"),
|
title_color: core.getInput("common_title_color"),
|
||||||
text_color: core.getInput("common_text_color"),
|
text_color: core.getInput("common_text_color"),
|
||||||
bg_color: core.getInput("common_bg_color"),
|
bg_color: core.getInput("common_bg_color"),
|
||||||
layout: parseBoolean(core.getInput("history_card_horizontal_layout"))
|
layout: core.getBooleanInput("history_card_horizontal_layout")
|
||||||
? "horizontal"
|
? "horizontal"
|
||||||
: undefined,
|
: undefined,
|
||||||
hide_title: parseBoolean(core.getInput("common_hide_title")),
|
hide_title: core.getBooleanInput("common_hide_title"),
|
||||||
hide_border: parseBoolean(core.getInput("common_hide_border")),
|
hide_border: core.getBooleanInput("common_hide_border"),
|
||||||
|
theme:
|
||||||
|
core.getInput("theme") in themes
|
||||||
|
? (core.getInput("theme") as keyof typeof themes)
|
||||||
|
: "default",
|
||||||
}).render()
|
}).render()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,12 @@ inputs:
|
||||||
type: string
|
type: string
|
||||||
default: domai-tb
|
default: domai-tb
|
||||||
|
|
||||||
|
theme:
|
||||||
|
description: The theme to use. See ./themes/themes.json
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: dark
|
||||||
|
|
||||||
profile_card_title:
|
profile_card_title:
|
||||||
description: Change the cards title
|
description: Change the cards title
|
||||||
required: false
|
required: false
|
||||||
|
|
Loading…
Add table
Reference in a new issue