Files
Folo/apps/mobile/src/theme/web.ts
T
Innei 93b38a7c70 feat(rn): impl markdown component for rn
- Added `es-toolkit` version 1.29.0 to `pnpm-lock.yaml` and `package.json`.
- Updated `typescript` to version 5.6.3 in `pnpm-lock.yaml`.
- Enhanced `CopyButton` component with new size option "tiny" and improved background color animation.
- Updated `Label`, `Select`, and `TextField` components to adjust height for better UI consistency.
- Refactored `PreviewUrl` component to use `ScrollView` and `MonoText` for improved text display.
- Added Markdown support in `rsshub-form` for better content presentation.
- Updated color handling in `colors.ts` for better theme management.

Signed-off-by: Innei <i@innei.in>
Signed-off-by: Innei <tukon479@gmail.com>
2024-12-31 23:34:13 +08:00

25 lines
664 B
TypeScript

import { useInsertionEffect } from "react"
import { useDarkMode } from "usehooks-ts"
import { colorVariants, palette } from "./colors"
export const useCSSInjection = () => {
const isDark = useDarkMode().isDarkMode
useInsertionEffect(() => {
const style = document.createElement("style")
const vars1 = colorVariants[isDark ? "dark" : "light"]
const vars2 = palette[isDark ? "dark" : "light"]
style.innerHTML = `:root {${[...Object.entries(vars1), ...Object.entries(vars2)]
.map(([key, value]) => `${key}: ${value};`)
.join("\n")}}`
document.head.append(style)
return () => {
style.remove()
}
}, [isDark])
}