diff --git a/media/ironvault_icon_100x100.svg b/media/ironvault_icon_100x100.svg new file mode 100644 index 00000000..e72453ab --- /dev/null +++ b/media/ironvault_icon_100x100.svg @@ -0,0 +1,58 @@ + + + + + + + + + diff --git a/src/index.ts b/src/index.ts index 9d3af3dc..f920e8fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,7 +86,7 @@ export default class IronVaultPlugin extends Plugin { await this.loadSettings(); addIcon( "iron-vault", - ``, + ``, ); this.datastore = this.addChild(new Datastore(this)); this.initializeIndexManager(); diff --git a/src/settings/ui.ts b/src/settings/ui.ts index 4b2a2adb..8fcb3f79 100644 --- a/src/settings/ui.ts +++ b/src/settings/ui.ts @@ -2,6 +2,24 @@ import IronVaultPlugin from "index"; import { PluginSettingTab, Setting, type App } from "obsidian"; import { IronVaultPluginSettings } from "settings"; import { FolderTextSuggest } from "utils/ui/settings/folder"; +import ironswornLogoBin from "../../media/ironvault_logo_ironsworn.png"; +import delveLogoBin from "../../media/ironvault_logo_delve.png"; +import starforgedLogoBin from "../../media/ironvault_logo_starforged.png"; +import sunderedIslesLogoBin from "../../media/ironvault_logo_sunderedisles.png"; + +function bytesToPngDataURI(bytes: Uint8Array) { + const binString = Array.from(bytes, (byte) => + String.fromCodePoint(byte), + ).join(""); + return "data:image/png;base64," + btoa(binString); +} + +const IS_LOGO = bytesToPngDataURI(ironswornLogoBin as unknown as Uint8Array); +const DELVE_LOGO = bytesToPngDataURI(delveLogoBin as unknown as Uint8Array); +const SF_LOGO = bytesToPngDataURI(starforgedLogoBin as unknown as Uint8Array); +const SI_LOGO = bytesToPngDataURI( + sunderedIslesLogoBin as unknown as Uint8Array, +); export class IronVaultSettingTab extends PluginSettingTab { plugin: IronVaultPlugin; @@ -61,7 +79,7 @@ export class IronVaultSettingTab extends PluginSettingTab { new Setting(containerEl).setName("Rulesets").setHeading(); - new Setting(containerEl) + const isSetting = new Setting(containerEl) .setName("Enable Ironsworn ruleset") .setDesc( "If enabled, Ironsworn Core oracles, assets, truths, and moves will be available for play.", @@ -71,8 +89,12 @@ export class IronVaultSettingTab extends PluginSettingTab { .setValue(settings.enableIronsworn) .onChange((value) => this.updateSetting("enableIronsworn", value)); }); + const isImg = document.createElement("img"); + isImg.src = IS_LOGO; + isImg.toggleClass("ruleset-img", true); + isSetting.settingEl.prepend(isImg); - new Setting(containerEl) + const delveSetting = new Setting(containerEl) .setName("Enable Delve expansion for Ironsworn") .setDesc( "(experimental) If enabled, Ironsworn: Delve Core oracles, assets, and moves will be available for play.", @@ -84,8 +106,12 @@ export class IronVaultSettingTab extends PluginSettingTab { this.updateSetting("enableIronswornDelve", value), ); }); + const delveImg = document.createElement("img"); + delveImg.src = DELVE_LOGO; + delveImg.toggleClass("ruleset-img", true); + delveSetting.settingEl.prepend(delveImg); - new Setting(containerEl) + const sfSetting = new Setting(containerEl) .setName("Enable Starforged ruleset") .setDesc( "If enabled, Ironsworn: Starforged oracles, assets, truths, and moves will be available for play.", @@ -95,8 +121,12 @@ export class IronVaultSettingTab extends PluginSettingTab { .setValue(settings.enableStarforged) .onChange((value) => this.updateSetting("enableStarforged", value)); }); + const sfImg = document.createElement("img"); + sfImg.src = SF_LOGO; + sfImg.toggleClass("ruleset-img", true); + sfSetting.settingEl.prepend(sfImg); - new Setting(containerEl) + const siSetting = new Setting(containerEl) .setName("Enable Sundered Isles expansion for Starforged") .setDesc( "(experimental) If enabled, Sundered Isles oracles, assets, and moves will be available for play. Sundered Isles data is considered in preview, pending finalization of the rulebook.", @@ -108,6 +138,10 @@ export class IronVaultSettingTab extends PluginSettingTab { this.updateSetting("enableSunderedIsles", value), ); }); + const siImg = document.createElement("img"); + siImg.src = SI_LOGO; + siImg.toggleClass("ruleset-img", true); + siSetting.settingEl.prepend(siImg); new Setting(containerEl).setName("Homebrew").setHeading(); diff --git a/src/styles.css b/src/styles.css index 36ceb84c..96fc03f5 100644 --- a/src/styles.css +++ b/src/styles.css @@ -39,8 +39,9 @@ } } -.internal-embed[alt~=iv-embed] { - & .markdown-embed-title, & .markdown-embed-link { +.internal-embed[alt~="iv-embed"] { + & .markdown-embed-title, + & .markdown-embed-link { display: none; } & .markdown-preview-view { @@ -53,6 +54,12 @@ } } +.ruleset-img { + height: 3.5em; + width: 3.5em; + padding: 0.2em 0; +} + #iron-vault-dice-box { position: fixed; top: 0;