### Usage example from SampleApp.kt Source: https://github.com/yasan-org/kepko Shows how to use SystemBarColorsEffect within KepkoTheme to set status bar and navigation bar background colors. This example is from the sample app's SampleApp.kt. ```kotlin KepkoTheme { SystemBarColorsEffect( statusBarBackgroundColor = KepkoTheme.colors.foreground, navigationBarBackgroundColor = KepkoTheme.colors.midground, ) // app content } ``` -------------------------------- ### Usage example with PreferenceSwitch and PreferenceRadioGroupPicker Source: https://github.com/yasan-org/kepko Example Settings composable showing a PreferenceSwitch for notifications and a side-by-side radio group picker for theme selection. The radio group uses PreferenceRadioGroupItem with palette entries and onSelectId callback. ```kotlin @Composable fun Settings() { PreferenceSwitch( title = "Notifications", checked = notificationsEnabled, onCheckedChange = { notificationsEnabled = it }, description = "Show a banner for new items", ) // Side-by-side radio group picker PreferenceRadioGroupPicker( title = "Theme", selectedId = selectedPaletteId, items = ColorPalette.entries.map { palette -> PreferenceRadioGroupItem(id = palette.id) { palette.title() } }, onSelectId = { id -> selectedPaletteId = id }, ) } ``` -------------------------------- ### Wrap app content with KepkoTheme Source: https://github.com/yasan-org/kepko/blob/main/README.md Wrap your app content with KepkoTheme to apply the theme. The example shows a Text and a TextPill with containerColor set to KepkoTheme.colors.information. ```kotlin KepkoTheme { Text("Hello, Kepko!") TextPill( text = "Yasan Glass", containerColor = KepkoTheme.colors.information, ) } ``` -------------------------------- ### Configure NavDisplay with ListDetailSceneStrategy Source: https://github.com/yasan-org/kepko/blob/main/README.md Sets up a two-pane list-detail navigation on large windows. The divider position is saved across launches, so wrap content in PersistentKepkoTheme. ```kotlin NavDisplay( backStack = backStack, sceneStrategies = listOf( rememberListDetailSceneStrategy( isLargeWindow = isLargeWindow(), isTwoPane = isTwoPaneWindow(), ), ), entryProvider = { route -> val metadata = if (route == Home) ListDetailSceneStrategy.list() else ListDetailSceneStrategy.detail() NavEntry(route, metadata = metadata) { /* screen */ } }, ) ``` -------------------------------- ### Equivalent Button composable Source: https://github.com/yasan-org/kepko/blob/main/README.md Shows the equivalent direct usage of Button with the same text, onClick, and leading icon as the decoded contract. ```kotlin Button( text = "Text Value", onClick = { println("on-click") }, leadingIcon = NamedIcon.INFO.painter(), ) ``` -------------------------------- ### Simple JSON for ButtonContract Source: https://github.com/yasan-org/kepko/blob/main/README.md JSON input that decodes into a ButtonContract. Uses snake_case keys like on_click and leading_icon. ```json { "on_click": "on-click", "text": "Text Value", "leading_icon": "info" } ``` -------------------------------- ### Add serialization module dependency Source: https://github.com/yasan-org/kepko/blob/main/README.md Adds the experimental serialization module for constructing Kepko components from JSON strings. ```kotlin implementation("glass.yasan.kepko:serialization:") ``` -------------------------------- ### Add navigation module dependency Source: https://github.com/yasan-org/kepko/blob/main/README.md Adds the experimental Navigation 3 module for large windows. Requires Android API 24 or later. ```kotlin implementation("glass.yasan.kepko:navigation:") ``` -------------------------------- ### Usage example with Icons and NamedIcon Source: https://github.com/yasan-org/kepko Shows how to use `Icons.settings` directly and resolve a `NamedIcon` by stable id (e.g., from a serialized contract) using `NamedIcon.fromIdOrNull`. The `painter()` call returns a `Painter` for use in `Icon` composables. ```kotlin import glass.yasan.kepko.resource.Icons import glass.yasan.kepko.resource.NamedIcon import glass.yasan.kepko.resource.Fonts @Composable fun MyScreen() { Icon(painter = Icons.settings, contentDescription = null) // Resolve by stable id, e.g. from a serialized contract: val icon = NamedIcon.fromIdOrNull("chevron_backward") // NamedIcon? icon?.painter()?.let { Icon(painter = it, contentDescription = null) } } ``` -------------------------------- ### Use PersistentPreferenceThemeScreen Source: https://github.com/yasan-org/kepko/blob/main/README.md Provides a UI for users to change the persisted theme setting. Lets users pick between system-based or manual theme selection; in system mode, separate light and dark style pickers are shown. ```kotlin PersistentPreferenceThemeScreen( onBackClick = { /* navigate back */ }, ) ``` -------------------------------- ### Usage example: themed border and focus ring Source: https://github.com/yasan-org/kepko Shows a themed border around a card using border() and a focus ring for keyboard navigation using focusBorder(). Requires OptIn to ExperimentalKepkoApi for the focus ring. ```kotlin import glass.yasan.kepko.foundation.border.border import glass.yasan.kepko.foundation.border.focusBorder import glass.yasan.kepko.foundation.border.borderStrokeFor // Themed border around a card Column( modifier = Modifier .border(shape = KepkoTheme.shapes.large) // color/width from theme .padding(16.dp), ) { ... } // Focus ring for keyboard navigation @OptIn(ExperimentalKepkoApi::class) Row(modifier = Modifier.focusBorder(KepkoTheme.shapes.extraLarge)) { ... } ``` -------------------------------- ### Add Kepko dependencies with Gradle Kotlin DSL Source: https://github.com/yasan-org/kepko/blob/main/README.md Declare the component and foundation artifacts from Maven Central in your build.gradle.kts. Replace with the current release. ```kotlin implementation("glass.yasan.kepko:component:") implementation("glass.yasan.kepko:foundation:") ``` -------------------------------- ### Use PersistentKepkoTheme Source: https://github.com/yasan-org/kepko/blob/main/README.md Replaces `KepkoTheme` to automatically persist and restore theme preferences across app launches. Requires the `@OptIn(ExperimentalKepkoApi::class)` annotation. ```kotlin @OptIn(ExperimentalKepkoApi::class) PersistentKepkoTheme { // your app content } ``` -------------------------------- ### Set desktop app id for persistence Source: https://github.com/yasan-org/kepko/blob/main/README.md Sets a unique app id for desktop persistence. By default, preferences are kept in `~/.kepko/` shared by all Kepko apps; set this before the first `PersistentKepkoTheme` is composed to give your app its own file. ```kotlin KepkoDesktopPersistence.appId = "com.example.app" ``` -------------------------------- ### Decode JSON into ButtonContract and render Source: https://github.com/yasan-org/kepko/blob/main/README.md Decodes the JSON string into a ButtonContract and renders it with ContractButton. The onClick receives the action string from the JSON. ```kotlin val contract = Json(from = kepkoJson).decodeFromString(jsonString) ContractButton( contract = contract, onClick = { action: String -> println(action) }, ) ``` -------------------------------- ### Add persistence dependency Source: https://github.com/yasan-org/kepko/blob/main/README.md Adds the optional persistence module to your project. On Android, this module requires API 24 or higher because preferences are stored with DataStore. ```kotlin implementation("glass.yasan.kepko:persistence:") ``` -------------------------------- ### PersistentKepkoTheme usage with LocalKepkoPersistenceManager Source: https://github.com/yasan-org/kepko Composable example showing how to access the persistence manager and color palette inside PersistentKepkoTheme. Requires @OptIn(ExperimentalKepkoApi::class). ```kotlin @OptIn(ExperimentalKepkoApi::class) @Composable fun App() { PersistentKepkoTheme { val persistence = LocalKepkoPersistenceManager.current val palette = LocalKepkoColorPalette.current PersistentPreferenceThemeButton( onClick = { /* navigate to theme screen */ }, ) } } ``` -------------------------------- ### NavDisplay usage with rememberListDetailSceneStrategy Source: https://github.com/yasan-org/kepko Example from the README showing how to configure NavDisplay with a list-detail scene strategy that adapts to large and two-pane windows. Requires @OptIn(ExperimentalKepkoApi::class). The entryProvider assigns list or detail metadata based on the route. ```kotlin @OptIn(ExperimentalKepkoApi::class) NavDisplay( backStack = backStack, sceneStrategies = listOf( rememberListDetailSceneStrategy( isLargeWindow = isLargeWindow(), isTwoPane = isTwoPaneWindow(), ), ), entryProvider = { route -> val metadata = if (route == Home) ListDetailSceneStrategy.list() else ListDetailSceneStrategy.detail() NavEntry(route, metadata = metadata) { /* screen */ } }, ) ``` -------------------------------- ### Icons object composable painter property Source: https://github.com/yasan-org/kepko Example of a composable val that returns a painterResource for a bundled drawable. ```kotlin public val add: Painter @Composable get() = painterResource(Res.drawable.ic_add) ``` -------------------------------- ### StatusArea composable using Foreground, TextTabular, KeyValue, TextPill Source: https://github.com/yasan-org/kepko Example usage of the component display API. It composes Foreground with a Column containing TextTabular, KeyValue, and TextPill components, using KepkoTheme shapes and colors. ```kotlin @Composable fun StatusArea() { Foreground(shape = KepkoTheme.shapes.medium) { Column(Modifier.padding(16.dp)) { TextTabular(text = "42", color = KepkoTheme.colors.content) KeyValue(key = "Version", value = "1.8.2") TextPill(text = "Beta", containerColor = KepkoTheme.colors.caution) } } } ``` -------------------------------- ### MainScreen composable using Scaffold with navigation layout Source: https://github.com/yasan-org/kepko Example of a composable function that uses Scaffold to create a screen with a title, back button, badge, subtitle, bottom bar, and content. The content includes an ExpandableColumn with a Text that is hidden until expanded. ```kotlin @Composable fun MainScreen(onBack: () -> Unit) { Scaffold( title = "Settings", onBackClick = onBack, badge = Badge.alpha, subtitle = { Subtitle(text = "About this screen", icon = Icons.info) }, bottomBar = { HorizontalDivider() }, ) { padding -> Column(Modifier.padding(padding)) { ExpandableColumn(title = "Advanced", expanded = true, onExpandChange = {}) { Text("Hidden until expanded") } } } } ``` -------------------------------- ### String Properties (Composable getters) Source: https://github.com/yasan-org/kepko A collection of composable properties that provide localized string resources for various UI elements such as navigation, badges, color palettes, preferences, and color names. Each property is a `String` with a `@Composable get()`. ```APIDOC ## String Properties (Composable getters) ### Description A collection of composable properties that provide localized string resources for various UI elements such as navigation, badges, color palettes, preferences, and color names. Each property is a `String` with a `@Composable get()`. ### Properties #### Navigation/accessibility - `back` (String) - Composable read of the localized resource. - `goBack` (String) - Composable read of the localized resource. - `enabled` (String) - Composable read of the localized resource. - `disabled` (String) - Composable read of the localized resource. - `reset` (String) - Composable read of the localized resource. #### Badges - `preferenceBadgeActive` (String) - Composable read of the localized resource. - `preferenceBadgeAlpha` (String) - Composable read of the localized resource. - `preferenceBadgeBeta` (String) - Composable read of the localized resource. - `preferenceBadgeDefault` (String) - Composable read of the localized resource. - `preferenceBadgeEarlyAccess` (String) - Composable read of the localized resource. - `preferenceBadgeExperimental` (String) - Composable read of the localized resource. - `preferenceBadgeLegacy` (String) - Composable read of the localized resource. - `preferenceBadgeNew` (String) - Composable read of the localized resource. - `preferenceBadgePreview` (String) - Composable read of the localized resource. #### Color palettes - `colorPaletteSystem` (String) - Composable read of the localized resource. - `colorPaletteBlack` (String) - Composable read of the localized resource. - `colorPaletteCatppuccinFrappe` (String) - Composable read of the localized resource. - `colorPaletteCatppuccinLatte` (String) - Composable read of the localized resource. - `colorPaletteCatppuccinMacchiato` (String) - Composable read of the localized resource. - `colorPaletteCatppuccinMocha` (String) - Composable read of the localized resource. - `colorPaletteGruvboxLight` (String) - Composable read of the localized resource. - `colorPaletteGruvboxDark` (String) - Composable read of the localized resource. - `colorPaletteTokyoNight` (String) - Composable read of the localized resource. - `colorPaletteTokyoDay` (String) - Composable read of the localized resource. - `colorPaletteBabyPink` (String) - Composable read of the localized resource. - `colorPaletteDarkPink` (String) - Composable read of the localized resource. - `colorPaletteHotPink` (String) - Composable read of the localized resource. - `colorPaletteDark` (String) - Composable read of the localized resource. - `colorPaletteDarkSolarized` (String) - Composable read of the localized resource. - `colorPaletteLight` (String) - Composable read of the localized resource. - `colorPaletteLightSolarized` (String) - Composable read of the localized resource. #### Preferences screen - `preferenceDarkPaletteDescription` (String) - Composable read of the localized resource. - `preferenceDarkPaletteTitle` (String) - Composable read of the localized resource. - `preferenceFollowGlobalTitle` (String) - Composable read of the localized resource. - `preferenceGrayscaleDescription` (String) - Composable read of the localized resource. - `preferenceGrayscaleTitle` (String) - Composable read of the localized resource. - `preferenceLightPaletteDescription` (String) - Composable read of the localized resource. - `preferenceLightPaletteTitle` (String) - Composable read of the localized resource. - `preferencePaletteModeDynamic` (String) - Composable read of the localized resource. - `preferencePaletteModeDynamicDescription` (String) - Composable read of the localized resource. - `preferencePaletteTitle` (String) - Composable read of the localized resource. - `preferenceStaticPaletteTitle` (String) - Composable read of the localized resource. - `preferenceOutlineTitle` (String) - Composable read of the localized resource. - `preferenceRoundnessTitle` (String) - Composable read of the localized resource. - `preferenceThemeScreenTitle` (String) - Composable read of the localized resource. #### Color names - `colorSuccess` (String) - Composable read of the localized resource. - `colorInformation` (String) - Composable read of the localized resource. - `colorCaution` (String) - Composable read of the localized resource. - `colorDanger` (String) - Composable read of the localized resource. - `colorForeground` (String) - Composable read of the localized resource. - `colorMidground` (String) - Composable read of the localized resource. - `colorBackground` (String) - Composable read of the localized resource. - `colorOutline` (String) - Composable read of the localized resource. - `colorContent` (String) - Composable read of the localized resource. - `colorContentSubtle` (String) - Composable read of the localized resource. - `colorContentDisabled` (String) - Composable read of the localized resource. ``` -------------------------------- ### Opting into ExperimentalKepkoApi with @OptIn Source: https://github.com/yasan-org/kepko Shows how consumers must annotate their code with @OptIn to use experimental APIs. ```kotlin @OptIn(ExperimentalKepkoApi::class) @Composable fun App() { PersistentKepkoTheme { /* ... */ } } ``` -------------------------------- ### KepkoTheme overload from Colors and ColorScheme Source: https://github.com/yasan-org/kepko Builds a theme from prebuilt Colors tokens and an optional Material 3 ColorScheme. Colors is required and only constructible via Colors(palette = ..., grayscale = ...) from the LIGHT import of ColorPalette; material3ColorScheme defaults to colors.toMaterial3ColorScheme(). ```kotlin @Composable public fun KepkoTheme( colors: Colors, dimensions: Dimensions = KepkoTheme.dimensions, shapes: Shapes = KepkoTheme.shapes, material3ColorScheme: ColorScheme = colors.toMaterial3ColorScheme(), content: @Composable () -> Unit, ) ``` -------------------------------- ### Basic KepkoTheme usage with Text and TextPill Source: https://github.com/yasan-org/kepko Basic usage from the project README. Wraps content in KepkoTheme and uses Text and TextPill components, with containerColor set to KepkoTheme.colors.information. ```kotlin import glass.yasan.kepko.foundation.theme.KepkoTheme import glass.yasan.kepko.component.Text import glass.yasan.kepko.component.TextPill KepkoTheme { Text("Hello, Kepko!") TextPill( text = "Yasan Glass", containerColor = KepkoTheme.colors.information, ) } ``` -------------------------------- ### Compiler opt-ins for experimental and internal APIs Source: https://github.com/yasan-org/kepko Add these compiler arguments to your foundation module's build.gradle.kts to opt in to experimental and internal Kepko APIs. Consumers of experimental APIs must also opt in themselves with @OptIn(ExperimentalKepkoApi::class) or their own compiler flag. ```kotlin freeCompilerArgs.add("-opt-in=glass.yasan.kepko.foundation.annotation.ExperimentalKepkoApi") freeCompilerArgs.add("-opt-in=glass.yasan.kepko.foundation.annotation.InternalKepkoApi") ``` -------------------------------- ### ProfilePersistenceManager Source: https://github.com/yasan-org/kepko Interface for managing per-profile persistence of palette and grayscale settings. Provides methods to get and set profile-specific palette and grayscale values. ```APIDOC ## ProfilePersistenceManager ### Description Interface for managing per-profile persistence of palette and grayscale settings. Provides methods to get and set profile-specific palette and grayscale values. ### Methods #### getProfilePalette(profileId: String): ColorPalette? - **profileId** (String) - Required - The ID of the profile. - Returns: The palette associated with the profile, or null if not set. #### setProfilePalette(profileId: String, value: ColorPalette?) - **profileId** (String) - Required - The ID of the profile. - **value** (ColorPalette?) - Required - The palette to set, or null to clear. #### getProfileGrayscale(profileId: String): Boolean? - **profileId** (String) - Required - The ID of the profile. - Returns: The grayscale setting for the profile, or null if not set. #### setProfileGrayscale(profileId: String, value: Boolean?) - **profileId** (String) - Required - The ID of the profile. - **value** (Boolean?) - Required - The grayscale setting to set, or null to clear. ``` -------------------------------- ### NamedColor members: resolve and fromIdOrNull Source: https://github.com/yasan-org/kepko Provides resolve(colors) to get the color and fromIdOrNull(id) for id lookup, returning null for unknown ids. ```kotlin public fun resolve(colors: Colors): Color = colors.resolve() public companion object { public fun fromIdOrNull(id: String): NamedColor? = entries.firstOrNull { it.id == id } } ``` -------------------------------- ### KepkoTheme overload from ColorPalette Source: https://github.com/yasan-org/kepko Builds a theme from a ColorPalette. The palette is required; grayscale converts all colors to luminance-equivalent gray via Colors.applyGrayscale(). Dimensions and shapes default to KepkoTheme.dimensions and KepkoTheme.shapes. ```kotlin @Composable public fun KepkoTheme( palette: ColorPalette, grayscale: Boolean = false, dimensions: Dimensions = KepkoTheme.dimensions, shapes: Shapes = KepkoTheme.shapes, content: @Composable () -> Unit, ) ``` -------------------------------- ### Catch JsonDecodingException when decoding ButtonContract Source: https://github.com/yasan-org/kepko Use this snippet to safely decode a ButtonContract from JSON and handle malformed payloads. The catch block logs the error and skips rendering the button. This is the only explicit code example on the page. ```kotlin try { val contract = Json(from = kepkoJson).decodeFromString(jsonString) ContractButton(contract = contract, onClick = ...) } catch (e: JsonDecodingException) { // log malformed payload; do not render the button } ``` -------------------------------- ### Window size helper functions (isLargeWindow, isTwoPaneWindow) Source: https://github.com/yasan-org/kepko Composable and non-composable overloads for detecting large (tablet-sized) and two-pane (list+detail) windows. Large window requires the smaller dimension to be at least 600 dp; two-pane requires width at least 840 dp and height at least 480 dp. Marked with @ExperimentalKepkoApi. ```kotlin @ExperimentalKepkoApi @Composable public fun isLargeWindow(): Boolean = isLargeWindow(LocalWindowInfo.current.containerDpSize) @ExperimentalKepkoApi public fun isLargeWindow(size: DpSize): Boolean = minOf(size.width, size.height) >= 600.dp @ExperimentalKepkoApi @Composable public fun isTwoPaneWindow(): Boolean = isTwoPaneWindow(LocalWindowInfo.current.containerDpSize) @ExperimentalKepkoApi public fun isTwoPaneWindow(size: DpSize): Boolean = size.width >= 840.dp && size.height >= 480.dp ``` -------------------------------- ### SegmentedPicker composable usage Source: https://github.com/yasan-org/kepko Example of a composable function that uses SegmentedPicker to switch between List and Grid view modes. The picker uses ICON_WITH_TEXT_REVEAL display mode and passes the selected mode and change callback. ```kotlin @Composable fun ViewModePicker(mode: ViewMode, onModeChange: (ViewMode) -> Unit) { SegmentedPicker( items = listOf( SegmentedPickerItem(value = ViewMode.List, icon = Icons.menu, text = "List"), SegmentedPickerItem(value = ViewMode.Grid, icon = Icons.shapes, text = "Grid"), ), selected = mode, onSelect = onModeChange, displayMode = SegmentedPickerDisplayMode.ICON_WITH_TEXT_REVEAL, ) } ``` -------------------------------- ### KepkoTheme overload from isDark Source: https://github.com/yasan-org/kepko Builds a theme from an isDark flag. Defaults to isSystemInDarkTheme(); when true, uses ColorPalette.DARK, otherwise ColorPalette.LIGHT. ```kotlin @Composable public fun KepkoTheme( isDark: Boolean = isSystemInDarkTheme(), grayscale: Boolean = false, dimensions: Dimensions = KepkoTheme.dimensions, shapes: Shapes = KepkoTheme.shapes, content: @Composable () -> Unit, ) ``` -------------------------------- ### SystemBarColorsEffect Source: https://github.com/yasan-org/kepko Applies background colors to both system bars (status and navigation). A null color leaves that bar unchanged. No-op on non-mobile platforms. ```APIDOC ## SystemBarColorsEffect ### Description Applies background colors to both system bars; a `null` color leaves that bar unchanged. **No-op on non-mobile platforms.** ### Signature ```kotlin @Composable public fun SystemBarColorsEffect( statusBarBackgroundColor: Color? = null, navigationBarBackgroundColor: Color? = null, ) ``` ### Parameters - `statusBarBackgroundColor` (`Color?`) - Default: `null` - Status bar background; content style resolved from luminance - `navigationBarBackgroundColor` (`Color?`) - Default: `null` - Navigation bar background; content style resolved from luminance ### Behavior If non-null, delegates to `StatusBarColorEffect` / `NavigationBarColorEffect`. ``` -------------------------------- ### ShareSheet usage example with ModalBottomSheet Source: https://github.com/yasan-org/kepko Shows a composable that uses ModalBottomSheet with a title and a Column containing sheet content. The title uses ModalBottomSheetTitle with text "Share", an Icons.send icon, and a description. ```kotlin @Composable fun ShareSheet(onDismiss: () -> Unit) { ModalBottomSheet( onDismissRequest = onDismiss, title = ModalBottomSheetTitle(text = "Share", icon = Icons.send, description = "Pick a destination"), ) { Column(Modifier.padding(horizontal = 20.dp, vertical = 16.dp)) { Text("Sheet content here") } } } ``` -------------------------------- ### PersistenceManager.getDefaultSnapshot() Source: https://github.com/yasan-org/kepko Returns the default snapshot of persisted theme settings. Use this to obtain the default values for theme configuration. ```APIDOC ## PersistenceManager.getDefaultSnapshot() ### Description Returns the default snapshot of persisted theme settings. Use this to obtain the default values for theme configuration. ### Response Default snapshot: primary `null`, light `LIGHT`, dark `DARK`, grayscale `false`, outline `DimensionTokens.borderThickness` (1 dp), roundness `1f`. ``` -------------------------------- ### KepkoTheme(colors: Colors, ...) Source: https://github.com/yasan-org/kepko Composable that builds a theme from prebuilt Colors tokens and a Material 3 ColorScheme. It is the only way to construct Colors is via the LIGHT import of ColorPalette. ```APIDOC ## [Composable] KepkoTheme(colors: Colors, ...) ### Description Composable that builds a theme from prebuilt Colors tokens and a Material 3 ColorScheme. It is the only way to construct Colors is via the LIGHT import of ColorPalette. ### Method Composable function ### Signature ```kotlin @Composable public fun KepkoTheme( colors: Colors, dimensions: Dimensions = KepkoTheme.dimensions, shapes: Shapes = KepkoTheme.shapes, material3ColorScheme: ColorScheme = colors.toMaterial3ColorScheme(), content: @Composable () -> Unit, ) ``` ### Parameters - **colors** (Colors) - Required - Token holder; the only way to construct it is `Colors(palette = ..., grayscale = ...)` from the `LIGHT`‑import of `ColorPalette` (constructor is `internal` to the `color` package) - **dimensions** (Dimensions) - Optional (default: `KepkoTheme.dimensions`) - Border thickness and icon size used by components - **shapes** (Shapes) - Optional (default: `KepkoTheme.shapes`) - Five corner-radius tiers used by components - **material3ColorScheme** (ColorScheme) - Optional (default: `colors.toMaterial3ColorScheme()`) - Material 3 scheme used for the underlying `MaterialTheme` - **content** (@Composable () -> Unit) - Required - The app content that reads the theme ### Return `Unit` (composable). Behavior: wraps content in `MaterialTheme(colorScheme = ..., typography = rubikTypography())` and provides `LocalColors`, `LocalDimensions`, `LocalShapes` and `LocalContentColor = colors.content`. ``` -------------------------------- ### ColorPalette companion functions Source: https://github.com/yasan-org/kepko Companion object providing default palettes and lookup/resolution functions. fromIdOrNull returns null for unknown ids; fromIdOrSystemDarkTheme falls back to system-dark resolution; fromSystemDarkTheme returns DARK when system is dark; fromDarkTheme returns DARK/LIGHT by flag. ```kotlin public companion object { public val defaultLight: ColorPalette get(): ColorPalette = LIGHT public val defaultDark: ColorPalette get(): ColorPalette = DARK @Composable public fun fromIdOrSystemDarkTheme(id: String?): ColorPalette = fromIdOrNull(id) ?: fromSystemDarkTheme() @Composable public fun fromSystemDarkTheme(): ColorPalette = fromDarkTheme(isDark = isSystemInDarkTheme()) public fun fromDarkTheme(isDark: Boolean): ColorPalette = if (isDark) DARK else LIGHT public fun fromIdOrNull(id: String?): ColorPalette? = entries.find { it.id == id } } ``` -------------------------------- ### toSnapshot() Source: https://github.com/yasan-org/kepko Creates a snapshot of the current global (non-profile) preference values. ```APIDOC ## toSnapshot() ### Description Creates a snapshot of the current global (non-profile) preference values. ### Method Function ### Signature `fun toSnapshot(): Snapshot` ### Returns - `Snapshot` - The current global preferences as a snapshot. ``` -------------------------------- ### CheckboxText composable signature Source: https://github.com/yasan-org/kepko Composable that renders a row of Text (14 sp) and Checkbox, with the whole row clickable via onClick = { onCheckedChange(!checked) }. Applies focusBorder and clip of shapes.extraLarge with 8 dp horizontal padding; the inner checkbox gets focusProperties { canFocus = false }. ```kotlin @Composable public fun CheckboxText( text: String, checked: Boolean, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, interactionSource: MutableInteractionSource? = null, indication: Indication? = LocalIndication.current, ) ``` -------------------------------- ### KepkoTheme(isDark: Boolean, ...) Source: https://github.com/yasan-org/kepko Composable that builds a theme from an is-dark flag. It chooses ColorPalette.DARK when true, ColorPalette.LIGHT otherwise. ```APIDOC ## [Composable] KepkoTheme(isDark: Boolean, ...) ### Description Composable that builds a theme from an is-dark flag. It chooses ColorPalette.DARK when true, ColorPalette.LIGHT otherwise. ### Method Composable function ### Signature ```kotlin @Composable public fun KepkoTheme( isDark: Boolean = isSystemInDarkTheme(), grayscale: Boolean = false, dimensions: Dimensions = KepkoTheme.dimensions, shapes: Shapes = KepkoTheme.shapes, content: @Composable () -> Unit, ) ``` ### Parameters - **isDark** (Boolean) - Optional (default: `isSystemInDarkTheme()`) - Chooses `ColorPalette.DARK` when `true`, `ColorPalette.LIGHT` otherwise - **grayscale** (Boolean) - Optional (default: `false`) - When `true`, all resolved colors are converted to luminance-equivalent gray via `Colors.applyGrayscale()` - **dimensions** (Dimensions) - Optional (default: `KepkoTheme.dimensions`) - Border thickness and icon size used by components - **shapes** (Shapes) - Optional (default: `KepkoTheme.shapes`) - Five corner-radius tiers used by components - **content** (@Composable () -> Unit) - Required - The app content that reads the theme ### Return `Unit` (composable). Behavior: wraps content in `MaterialTheme(colorScheme = ..., typography = rubikTypography())` and provides `LocalColors`, `LocalDimensions`, `LocalShapes` and `LocalContentColor = colors.content`. ``` -------------------------------- ### KepkoTheme(palette: ColorPalette, ...) Source: https://github.com/yasan-org/kepko Composable that builds a theme from a ColorPalette. It resolves all Colors tokens from the palette and optionally applies grayscale conversion. ```APIDOC ## [Composable] KepkoTheme(palette: ColorPalette, ...) ### Description Composable that builds a theme from a ColorPalette. It resolves all Colors tokens from the palette and optionally applies grayscale conversion. ### Method Composable function ### Signature ```kotlin @Composable public fun KepkoTheme( palette: ColorPalette, grayscale: Boolean = false, dimensions: Dimensions = KepkoTheme.dimensions, shapes: Shapes = KepkoTheme.shapes, content: @Composable () -> Unit, ) ``` ### Parameters - **palette** (ColorPalette) - Required - The active color palette; every `Colors` token is resolved from it - **grayscale** (Boolean) - Optional (default: `false`) - When `true`, all resolved colors are converted to luminance-equivalent gray via `Colors.applyGrayscale()` - **dimensions** (Dimensions) - Optional (default: `KepkoTheme.dimensions`) - Border thickness and icon size used by components - **shapes** (Shapes) - Optional (default: `KepkoTheme.shapes`) - Five corner-radius tiers used by components - **content** (@Composable () -> Unit) - Required - The app content that reads the theme ### Return `Unit` (composable). Behavior: wraps content in `MaterialTheme(colorScheme = ..., typography = rubikTypography())` and provides `LocalColors`, `LocalDimensions`, `LocalShapes` and `LocalContentColor = colors.content`. ``` -------------------------------- ### KepkoTheme Source: https://github.com/yasan-org/kepko Constructor options for creating a KepkoTheme instance. Use this to configure the theme's palette, colors, dimensions, shapes, and other visual properties. ```APIDOC ## KepkoTheme ### Description Constructor options for creating a KepkoTheme instance. Use this to configure the theme's palette, colors, dimensions, shapes, and other visual properties. ### Parameters - **palette** (`ColorPalette`) - Optional - Overload-dependent. Applies to overload 1. - **isDark** (`Boolean`) - Optional - Default: `isSystemInDarkTheme()`. Applies to overload 2. - **grayscale** (`Boolean`) - Optional - Default: `false`. Applies to overloads 1–2. - **colors** (`Colors`) - Optional - Applies to overload 3. - **dimensions** (`Dimensions`) - Optional - Default: `KepkoTheme.dimensions`. Applies to all. - **shapes** (`Shapes`) - Optional - Default: `KepkoTheme.shapes`. Applies to all. - **material3ColorScheme** (`ColorScheme`) - Optional - Default: `colors.toMaterial3ColorScheme()`. Applies to overload 3. ### Notes - `Dimensions`/`Shapes` builders: `dimensions(borderThickness = 1.dp, iconSize = 24.dp)` and `shapes(extraSmall..extraLarge = RoundedCornerShape(4/8/12/16/28.dp))` (tokens are `@InternalKepkoApi`). ``` -------------------------------- ### getAllIcons function signature Source: https://github.com/yasan-org/kepko Composable function that returns a map of all `ic_*` drawables keyed by humanized names (e.g., `ic_add` → `"Add"`). Sorted by resource key; used by the sample's icon screen. ```kotlin @Composable public fun getAllIcons(): Map ``` -------------------------------- ### getDefaultSnapshot() Source: https://github.com/yasan-org/kepko Returns the default snapshot of all preferences, representing the initial state. ```APIDOC ## getDefaultSnapshot() ### Description Returns the default snapshot of all preferences, representing the initial state. ### Method Function ### Signature `fun getDefaultSnapshot(): Snapshot` ### Returns - `Snapshot` - The default snapshot with primary `null`, light `LIGHT`, dark `DARK`, grayscale `false`, outline `1.dp`, roundness `1f`. ``` -------------------------------- ### Colors class constructor Source: https://github.com/yasan-org/kepko Central token holder with internal constructor; public callers use KepkoTheme(palette = …) or Colors(palette = LIGHT) within the internal package. All colors map through an inversePalette per palette (e.g., LIGHT → DARK). ```kotlin @Immutable public class Colors internal constructor( public val palette: ColorPalette, private val grayscale: Boolean = false, ) ``` -------------------------------- ### PersistentKepkoTheme Source: https://github.com/yasan-org/kepko Constructor options for creating a PersistentKepkoTheme instance. Use this to configure a theme that persists user preferences. ```APIDOC ## PersistentKepkoTheme ### Description Constructor options for creating a PersistentKepkoTheme instance. Use this to configure a theme that persists user preferences. ### Parameters - **persistenceManager** (`PersistenceManager`) - Optional - Default: `SingletonPersistenceManager.instance`. - **dimensions** (`Dimensions`) - Optional - Default: `KepkoTheme.dimensions` (then `borderThickness = outline`). - **isSystemInDarkTheme** (`Boolean`) - Optional - Default: `isSystemInDarkTheme()`. - **profileId** (`String?`) - Optional - Default: `null`. ### Notes - Persisted value ranges used by `PersistentPreferenceThemeScreen` sliders: outline `1f..5f` (Dp, 3 steps), roundness `0f..1.6f` (15 steps). ``` -------------------------------- ### KepkoTheme object Source: https://github.com/yasan-org/kepko Static accessors for the currently-provided theme tokens. All three are @Composable reads of the corresponding CompositionLocal. ```APIDOC ## KepkoTheme object ### Description Static accessors for the currently-provided tokens. All three are `@Composable` reads of the corresponding `CompositionLocal`. ### Members - `colors`: `Colors` - Current color tokens (see `foundation-colors.md`) - `dimensions`: `Dimensions` - Current dimension tokens - `shapes`: `Shapes` - Current shape tokens ### Source Code ```kotlin public object KepkoTheme { public val colors: Colors @Composable @ReadOnlyComposable get() = LocalColors.current public val dimensions: Dimensions @Composable @ReadOnlyComposable get() = LocalDimensions.current public val shapes: Shapes @Composable @ReadOnlyComposable get() = LocalShapes.current } ``` ``` -------------------------------- ### KepkoTheme object with composable accessors Source: https://github.com/yasan-org/kepko Provides static accessors for the currently-provided color, dimension, and shape tokens. All three are @Composable reads of the corresponding CompositionLocal (LocalColors, LocalDimensions, LocalShapes). ```kotlin public object KepkoTheme { public val colors: Colors @Composable @ReadOnlyComposable get() = LocalColors.current public val dimensions: Dimensions @Composable @ReadOnlyComposable get() = LocalDimensions.current public val shapes: Shapes @Composable @ReadOnlyComposable get() = LocalShapes.current } ``` -------------------------------- ### ListDetailSceneStrategy class declaration Source: https://github.com/yasan-org/kepko Defines the experimental ListDetailSceneStrategy class for Navigation 3, with an internal constructor and companion object methods list() and detail(). calculateScene returns null when neither isLargeWindow nor isTwoPane, otherwise finds the last list() entry and requires all entries above it to be detail() metadata. ```kotlin @ExperimentalKepkoApi public class ListDetailSceneStrategy internal constructor( private val isLargeWindow: Boolean, private val isTwoPane: Boolean, private val paneState: ListDetailPaneState, ) : SceneStrategy { public companion object { public fun list(): Map public fun detail(): Map } override fun SceneStrategyScope.calculateScene(entries: List>): Scene? } ``` -------------------------------- ### TextTabularDefaults object with defaultCandidates and animationSpec Source: https://github.com/yasan-org/kepko Provides default candidate characters for width measurement and a spring-based animation spec with configurable damping ratio and stiffness. Defaults: DampingRatioLowBouncy and StiffnessMedium. ```kotlin @ExperimentalKepkoApi public object TextTabularDefaults { public val defaultCandidates: List = ('0'..'9') + ('A'..'Z') + ('a'..'z') + listOf('.', '-', '+', ',', ':', ' ') public fun animationSpec( dampingRatio: Float = Spring.DampingRatioLowBouncy, stiffness: Float = Spring.StiffnessMedium, ): AnimationSpec = spring(dampingRatio = dampingRatio, stiffness = stiffness) } ``` -------------------------------- ### SystemBarColorsEffect composable function Source: https://github.com/yasan-org/kepko Applies background colors to both system bars; a null color leaves that bar unchanged. No-op on non-mobile platforms. Delegates to StatusBarColorEffect / NavigationBarColorEffect when non-null. ```kotlin @Composable public fun SystemBarColorsEffect( statusBarBackgroundColor: Color? = null, navigationBarBackgroundColor: Color? = null, ) ``` -------------------------------- ### PreviewPersistentKepkoTheme composable signature Source: https://github.com/yasan-org/kepko In-memory manager (no persistence) for previews; `configure` mutates a fresh `PreviewPersistenceManager`. The active `ColorPalette` is always based on the `isSystemInDarkTheme` parameter. ```kotlin @OptIn(ExperimentalKepkoApi::class) @Composable public fun PreviewPersistentKepkoTheme( isSystemInDarkTheme: Boolean = false, configure: PreviewPersistenceManager.() -> Unit = {}, content: @Composable () -> Unit, ) ``` -------------------------------- ### DialogScrimEffect Android actual implementation Source: https://github.com/yasan-org/kepko Android actual implementation of DialogScrimEffect. Uses currentDialogWindow() and LaunchedEffect to set the window's dim amount and add FLAG_DIM_BEHIND. ```kotlin @Composable public actual fun DialogScrimEffect(color: Color) { val dialogWindow = currentDialogWindow() LaunchedEffect(dialogWindow, color) { dialogWindow ?: return@LaunchedEffect dialogWindow.setDimAmount(color.alpha) dialogWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) } } ``` -------------------------------- ### PreviewPersistentKepkoTheme Source: https://github.com/yasan-org/kepko Composable function that provides an in-memory persistence manager for previews. It allows configuration of the manager and uses the isSystemInDarkTheme parameter to determine the active ColorPalette. ```APIDOC ## PreviewPersistentKepkoTheme ### Description In-memory manager (no persistence) for previews; `configure` mutates a fresh `PreviewPersistenceManager`. The active `ColorPalette` is always based on the `isSystemInDarkTheme` parameter. ### Method Composable function ### Signature ```kotlin @OptIn(ExperimentalKepkoApi::class) @Composable public fun PreviewPersistentKepkoTheme( isSystemInDarkTheme: Boolean = false, configure: PreviewPersistenceManager.() -> Unit = {}, content: @Composable () -> Unit, ) ``` ### Parameters - **isSystemInDarkTheme** (Boolean) - Optional - Default: false. Determines the active ColorPalette. - **configure** (PreviewPersistenceManager.() -> Unit) - Optional - Default: {}. Mutates a fresh PreviewPersistenceManager. - **content** (@Composable () -> Unit) - Required - The composable content to be rendered within the theme. ``` -------------------------------- ### NamedIcon companion fromIdOrNull Source: https://github.com/yasan-org/kepko Provides id lookup returning null for unknown ids. ```kotlin public companion object { public fun fromIdOrNull(id: String): NamedIcon? = entries.firstOrNull { it.id == id } } ``` -------------------------------- ### ProgressIndicator overloads and ProgressIndicatorDefaults Source: https://github.com/yasan-org/kepko Four @Composable overloads for circular and linear progress indicators, plus the ProgressIndicatorDefaults object providing default color and trackColor from KepkoTheme.colors. ```kotlin @Composable public fun CircularProgressIndicator(progress: () -> Float, modifier: Modifier = Modifier, color: Color = ProgressIndicatorDefaults.color, trackColor: Color = ProgressIndicatorDefaults.trackColor) @Composable public fun CircularProgressIndicator(modifier: Modifier = Modifier, color: Color = ProgressIndicatorDefaults.color, trackColor: Color = ProgressIndicatorDefaults.trackColor) @Composable public fun LinearProgressIndicator(progress: () -> Float, modifier: Modifier = Modifier, color: Color = ProgressIndicatorDefaults.color, trackColor: Color = ProgressIndicatorDefaults.trackColor) @Composable public fun LinearProgressIndicator(modifier: Modifier = Modifier, color: Color = ProgressIndicatorDefaults.color, trackColor: Color = ProgressIndicatorDefaults.trackColor) public object ProgressIndicatorDefaults { public val color: Color @Composable get() = KepkoTheme.colors.content public val trackColor: Color @Composable get() = KepkoTheme.colors.contentSubtle } ``` -------------------------------- ### reset() Source: https://github.com/yasan-org/kepko Resets all preferences to their default values by applying the default snapshot. ```APIDOC ## reset() ### Description Resets all preferences to their default values by applying the default snapshot. ### Method Function ### Signature `fun reset()` ``` -------------------------------- ### Colors companion helper functions Source: https://github.com/yasan-org/kepko Top-level composable functions in the same file returning arrays of semantic, layer, and content colors in the order used by component previews. ```kotlin @Composable public fun Colors.getSemanticColors(): Array = arrayOf(success, information, caution, danger) @Composable public fun Colors.getLayerColors(): Array = arrayOf(foreground, midground, background) @Composable public fun Colors.getContentColors(): Array = arrayOf(content, contentSubtle, contentDisabled) ``` -------------------------------- ### Resolving palette from persisted id with system fallback Source: https://github.com/yasan-org/kepko Resolves a ColorPalette from a persisted string id using ColorPalette.fromIdOrSystemDarkTheme, then passes it to KepkoTheme along with a grayscale flag. ```kotlin val palette = ColorPalette.fromIdOrSystemDarkTheme(preferences.getString("palette_id")) KepkoTheme(palette = palette, grayscale = isGrayscale) { // app } ``` -------------------------------- ### ExperimentalKepkoApi annotation declaration Source: https://github.com/yasan-org/kepko Opt-in annotation with ERROR level, requiring explicit opt-in. Applied to many experimental APIs. ```kotlin @RequiresOptIn( level = ERROR, message = "This Kepko API is experimental and is likely to change or to be removed in the future.", ) @Retention(AnnotationRetention.BINARY) @Target( AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, ) public annotation class ExperimentalKepkoApi ```