-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80a5922
commit d36207b
Showing
8 changed files
with
2,024 additions
and
1,987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import React from "react"; | ||
import { useTheme } from "@/contexts/ThemeContext"; | ||
import { generateThemeJSON } from "@/lib/utils/exportTheme"; | ||
import React from 'react' | ||
import { useTheme } from '@/contexts/ThemeContext' | ||
import { generateThemeJSON } from '@/lib/utils/exportTheme' | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { Button } from '@/components/ui/button' | ||
|
||
const ExportButton: React.FC = () => { | ||
const { colors, syntaxColors, ansiColors } = useTheme(); | ||
const { colors, syntaxColors, ansiColors } = useTheme() | ||
|
||
const exportTheme = () => { | ||
const themeJSON = generateThemeJSON(colors, syntaxColors, ansiColors); | ||
const blob = new Blob([themeJSON], { type: "application/json" }); | ||
const url = URL.createObjectURL(blob); | ||
const a = document.createElement("a"); | ||
a.href = url; | ||
a.download = "generated-theme.json"; | ||
a.click(); | ||
URL.revokeObjectURL(url); | ||
}; | ||
const themeJSON = generateThemeJSON(colors, syntaxColors, ansiColors) | ||
const blob = new Blob([themeJSON], { type: 'application/json' }) | ||
const url = URL.createObjectURL(blob) | ||
const a = document.createElement('a') | ||
a.href = url | ||
a.download = 'Generated-color-theme.json' | ||
a.click() | ||
URL.revokeObjectURL(url) | ||
} | ||
|
||
return ( | ||
<Button className="mt-4" onClick={exportTheme}> | ||
Export Theme | ||
</Button> | ||
); | ||
}; | ||
) | ||
} | ||
|
||
export default ExportButton; | ||
export default ExportButton |
Oops, something went wrong.