Description
Add ColorResolver and SolidColorResolver for androidx.compose.ui.graphics.Color and androidx.compose.ui.graphics.SolidColor, plus ColorStrategy to control color generation mode. All live in dev.appoutlet.some.android.
-
Scope and constraints
ColorStrategy is a sealed interface extending Strategy with variants: RandomArgb (default), RandomHsl, Palette (with a fixed color list). It lives in dev.appoutlet.some.android.strategy.
ColorResolver generates Color(red, green, blue, alpha) with randomized components when using RandomArgb; uses HSL conversion for RandomHsl; picks from the configured palette for Palette. Constructor receives strategyProvider: StrategyProvider and random: Random. It lives in dev.appoutlet.some.android.resolver.compose.
- The resolver fetches the strategy once in
init: strategyProvider.get<ColorStrategy>() ?: ColorStrategy.default.
SolidColorResolver creates SolidColor(color) by delegating to the chain to resolve a Color first. Constructor receives random: Random only. It lives in dev.appoutlet.some.android.resolver.compose.
- Both
canResolve() use exact type matching via typeOf<T>().
- Each resolver has its own JVM unit test class. ColorResolver tests verify each strategy variant. SolidColorResolver tests verify it produces a SolidColor wrapping a non-null Color.
- Depends on
androidx.compose.ui:ui (transitively provides ui-graphics).
-
References
Scope
In scope: ColorStrategy sealed interface + variants, ColorResolver, SolidColorResolver, JVM unit tests.
Out of scope: registering resolvers in AndroidTypeResolverProvider (ticket #14).
Acceptance criteria
Description
Add
ColorResolverandSolidColorResolverforandroidx.compose.ui.graphics.Colorandandroidx.compose.ui.graphics.SolidColor, plusColorStrategyto control color generation mode. All live indev.appoutlet.some.android.Scope and constraints
ColorStrategyis a sealed interface extendingStrategywith variants:RandomArgb(default),RandomHsl,Palette(with a fixed color list). It lives indev.appoutlet.some.android.strategy.ColorResolvergeneratesColor(red, green, blue, alpha)with randomized components when usingRandomArgb; uses HSL conversion forRandomHsl; picks from the configured palette forPalette. Constructor receivesstrategyProvider: StrategyProviderandrandom: Random. It lives indev.appoutlet.some.android.resolver.compose.init:strategyProvider.get<ColorStrategy>() ?: ColorStrategy.default.SolidColorResolvercreatesSolidColor(color)by delegating to thechainto resolve aColorfirst. Constructor receivesrandom: Randomonly. It lives indev.appoutlet.some.android.resolver.compose.canResolve()use exact type matching viatypeOf<T>().androidx.compose.ui:ui(transitively providesui-graphics).References
Scope
In scope:
ColorStrategysealed interface + variants,ColorResolver,SolidColorResolver, JVM unit tests.Out of scope: registering resolvers in
AndroidTypeResolverProvider(ticket #14).Acceptance criteria
ColorResolvergenerates colors in defaultRandomArgbmodeColorStrategy.RandomHslproduces valid HSL-converted colorsColorStrategy.Paletteonly produces colors from the configured listSolidColorResolverproduces aSolidColorwrapping a non-nullColorcanResolvereturns true for its own type and false for othersandroid.jarwithandroidx.compose.ui:uion classpath and run as JVM unit tests