@@ -10,6 +10,8 @@ import LauncherThemed from "@/components/themes/windows/LauncherThemed.vue";
1010import SettingsThemed from " @/components/themes/windows/SettingsThemed.vue" ;
1111import type { TranslationsReferenceType } from " @/types/translations-reference.type.ts" ;
1212import { TranslationsContextKey } from " @/constants/application.ts" ;
13+ import { saveAs } from " file-saver" ;
14+ import JSZip from " jszip" ;
1315
1416const translations = inject <TranslationsReferenceType >(TranslationsContextKey );
1517
@@ -28,6 +30,31 @@ function selectColor({
2830function resetColors() {
2931 colors .value = { ... DefaultColors };
3032}
33+
34+ function downloadTheme() {
35+ const zip = new JSZip ;
36+ const randomKey = Math .floor (Math .random () * 10_000 );
37+ const folder = zip .folder (` customTheme${randomKey } ` );
38+
39+ if (! folder ) {
40+ return ;
41+ }
42+
43+ folder .file (" themeStyle.css" , " /* WIP */" );
44+ folder .file (" theme.json" , JSON .stringify ({
45+ " colors" : {
46+ ... colors .value ,
47+ " fadeAmount" : 0.5 ,
48+ " fadeColor" : " #000000" ,
49+ },
50+ " name" : ` A Custom Theme <${randomKey }> ` ,
51+ " widgets" : " Fusion" ,
52+ }, null , 2 ));
53+
54+ zip .generateAsync ({ " type" : " blob" }).then (content => {
55+ saveAs (content , ` customTheme${randomKey }.zip ` );
56+ });
57+ }
3158 </script >
3259
3360<template >
@@ -62,6 +89,9 @@ function resetColors() {
6289 </button >
6390 </div >
6491 <div class =" w-full flex flex-col gap-4 py-4 pr-4" >
92+ <button @click =" downloadTheme" class =" w-fit rounded-md p-3 leading-none transition-[background-color] hover:bg-catppuccin-800" >
93+ Download
94+ </button >
6595 <ColorGenerator
6696 v-if =" selected === 'colors'"
6797 :colors =" colors"
0 commit comments