From 25fc48fb17b53fe1c155c4f53f673ed91fdd8f74 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Fri, 19 Jun 2026 19:16:25 +0200 Subject: Initial extraction from Norganize --- .../NorgEditor/EnvironmentValues+EditorTheme.swift | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Sources/NorgEditor/EnvironmentValues+EditorTheme.swift (limited to 'Sources/NorgEditor/EnvironmentValues+EditorTheme.swift') diff --git a/Sources/NorgEditor/EnvironmentValues+EditorTheme.swift b/Sources/NorgEditor/EnvironmentValues+EditorTheme.swift new file mode 100644 index 0000000..f0bc3c5 --- /dev/null +++ b/Sources/NorgEditor/EnvironmentValues+EditorTheme.swift @@ -0,0 +1,21 @@ +#if canImport(UIKit) || canImport(AppKit) + import SwiftUI + + private struct NorgEditorThemeKey: EnvironmentKey { + static let defaultValue = EditorTheme.default + } + + /// Makes NorgTheme values accessible via the environment. + extension EnvironmentValues { + public var norgEditorTheme: EditorTheme { + get { self[NorgEditorThemeKey.self] } + set { self[NorgEditorThemeKey.self] = newValue } + } + } + + extension View { + public func norgEditorTheme(_ theme: EditorTheme) -> some View { + environment(\.norgEditorTheme, theme) + } + } +#endif -- cgit