Add Raiden Themes plugin
This commit is contained in:
parent
498d5c49db
commit
4a5407ec21
4 changed files with 210 additions and 0 deletions
8
plugins/raidens-themes/manifest.json
Normal file
8
plugins/raidens-themes/manifest.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "Raiden's Themes",
|
||||
"description": "A one-tap theme switcher that gathers and applies themes from backroomsa3-a11y/Mythemesssss.",
|
||||
"authors": [
|
||||
{ "name": "Raiden" }
|
||||
],
|
||||
"main": "src/index.ts"
|
||||
}
|
||||
10
plugins/raidens-themes/src/index.ts
Normal file
10
plugins/raidens-themes/src/index.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { storage } from "@vendetta/plugin";
|
||||
import Settings from "./ui/Settings";
|
||||
|
||||
storage.current ??= "";
|
||||
|
||||
export default {
|
||||
onLoad: () => {},
|
||||
onUnload: () => {},
|
||||
settings: Settings
|
||||
};
|
||||
112
plugins/raidens-themes/src/lib/themes.ts
Normal file
112
plugins/raidens-themes/src/lib/themes.ts
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
export const THEMES = [
|
||||
{
|
||||
"id": "911",
|
||||
"name": "Porsche 911 GT Silver",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/911.json"
|
||||
},
|
||||
{
|
||||
"id": "A",
|
||||
"name": "Salon Solitaire: Liquid Glass",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/A.json"
|
||||
},
|
||||
{
|
||||
"id": "Bill",
|
||||
"name": "mogger of World",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Bill.json"
|
||||
},
|
||||
{
|
||||
"id": "Dante",
|
||||
"name": "Sanguine Shadows",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Dante.json"
|
||||
},
|
||||
{
|
||||
"id": "E",
|
||||
"name": "Noctra",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/E.json"
|
||||
},
|
||||
{
|
||||
"id": "Emma",
|
||||
"name": "Emma Veil",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Emma.json"
|
||||
},
|
||||
{
|
||||
"id": "Falh",
|
||||
"name": "Porsche 911 GT Silver",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Falh.json"
|
||||
},
|
||||
{
|
||||
"id": "Fraud",
|
||||
"name": "Noctra",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Fraud.json"
|
||||
},
|
||||
{
|
||||
"id": "Furina",
|
||||
"name": "Salon Solitaire: Furina",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Furina.json"
|
||||
},
|
||||
{
|
||||
"id": "Genshin",
|
||||
"name": "Salon Solitaire: Furina",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Genshin.json"
|
||||
},
|
||||
{
|
||||
"id": "Goatjo",
|
||||
"name": "i love kitkats",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Goatjo.json"
|
||||
},
|
||||
{
|
||||
"id": "Idk",
|
||||
"name": "Salon Solitaire: Lumine Hydro",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Idk.json"
|
||||
},
|
||||
{
|
||||
"id": "No",
|
||||
"name": "Salon Solitaire: Liquid Glass",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/No.json"
|
||||
},
|
||||
{
|
||||
"id": "Rs",
|
||||
"name": "Porsche 911 (992)",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Rs.json"
|
||||
},
|
||||
{
|
||||
"id": "Ryomen",
|
||||
"name": "Noctra",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Ryomen.json"
|
||||
},
|
||||
{
|
||||
"id": "Snowman",
|
||||
"name": "Snowy Rain",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Snowman.json"
|
||||
},
|
||||
{
|
||||
"id": "This",
|
||||
"name": "Obsidian Luxe",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/This.json"
|
||||
},
|
||||
{
|
||||
"id": "Tung",
|
||||
"name": "Limitless",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Tung.json"
|
||||
},
|
||||
{
|
||||
"id": "Twin",
|
||||
"name": "Porsche 911 (992)",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Twin.json"
|
||||
},
|
||||
{
|
||||
"id": "Vergil",
|
||||
"name": "Noctra",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Vergil.json"
|
||||
},
|
||||
{
|
||||
"id": "Yes",
|
||||
"name": "Salon Solitaire: Liquid Glass",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Yes.json"
|
||||
},
|
||||
{
|
||||
"id": "You",
|
||||
"name": "Salon Solitaire: Liquid Glass",
|
||||
"url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/You.json"
|
||||
}
|
||||
];
|
||||
80
plugins/raidens-themes/src/ui/Settings.tsx
Normal file
80
plugins/raidens-themes/src/ui/Settings.tsx
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
import { React, ReactNative } from "@vendetta/metro/common";
|
||||
import { storage } from "@vendetta/plugin";
|
||||
import { useProxy } from "@vendetta/storage";
|
||||
import { clipboard } from "@vendetta/metro/common";
|
||||
import { showToast } from "@vendetta/ui/toasts";
|
||||
import { TableRow, TableRowGroup, TableRowArrow } from "@shared/ui/table";
|
||||
import SettingsScaffold from "@shared/ui/SettingsScaffold";
|
||||
import NoteBox from "@shared/ui/NoteBox";
|
||||
import { THEMES } from "../lib/themes";
|
||||
|
||||
const { Text } = ReactNative;
|
||||
|
||||
export default function Settings() {
|
||||
useProxy(storage);
|
||||
|
||||
const applyTheme = async (theme: typeof THEMES[number]) => {
|
||||
const bunny = (window as any).bunny;
|
||||
|
||||
if (!bunny?.themes?.installTheme) {
|
||||
clipboard.setString(theme.url);
|
||||
showToast("Theme URL copied — paste it into Settings > Revenge > Themes");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await bunny.themes.installTheme(theme.url);
|
||||
const installed = bunny.themes.themes?.[theme.url];
|
||||
if (installed && bunny.themes.selectTheme) {
|
||||
bunny.themes.selectTheme(installed);
|
||||
}
|
||||
storage.current = theme.id;
|
||||
showToast(`Switched to ${theme.name}`);
|
||||
} catch (e: any) {
|
||||
showToast(`Failed to apply theme: ${e?.message ?? e}`);
|
||||
}
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
const bunny = (window as any).bunny;
|
||||
|
||||
if (!bunny?.themes?.selectTheme) {
|
||||
showToast("Revenge theme engine not available");
|
||||
return;
|
||||
}
|
||||
|
||||
bunny.themes.selectTheme(null);
|
||||
storage.current = "";
|
||||
showToast("Default theme restored");
|
||||
};
|
||||
|
||||
return (
|
||||
<SettingsScaffold>
|
||||
<NoteBox>
|
||||
Tap a theme to install and apply it instantly. If the one-tap theme engine isn't available,
|
||||
the theme URL is copied to your clipboard instead.
|
||||
</NoteBox>
|
||||
<TableRowGroup title="Default">
|
||||
<TableRow
|
||||
label="Reset to default"
|
||||
onPress={reset}
|
||||
/>
|
||||
</TableRowGroup>
|
||||
<TableRowGroup title="Raiden's Themes">
|
||||
{THEMES.map((theme) => (
|
||||
<TableRow
|
||||
key={theme.id}
|
||||
label={theme.name}
|
||||
subLabel={theme.id}
|
||||
onPress={() => applyTheme(theme)}
|
||||
trailing={
|
||||
storage.current === theme.id
|
||||
? <Text style={{ fontSize: 16 }}>✓</Text>
|
||||
: <TableRowArrow />
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</TableRowGroup>
|
||||
</SettingsScaffold>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue