-
Notifications
You must be signed in to change notification settings - Fork 1
Pp 2078 provide color keys per element #883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package net.gini.android.capture.ui.theme.colors | ||
|
|
||
| import android.content.Context | ||
| import androidx.compose.ui.graphics.Color | ||
| import net.gini.android.capture.R | ||
|
|
||
| data class GiniColorElementsPrimitives( | ||
| val skontoSectionTitleTextColor: Color = Color(0xFF161616), | ||
|
|
||
| ) { | ||
| companion object { | ||
| /** | ||
| * Bridge between old way of defining colors by overridden resources and Compose | ||
| * | ||
| * This function will define color primitives based on resources value at res/colors.xml | ||
| */ | ||
| internal fun buildColorPrimitivesBasedOnResources(context: Context) = GiniColorElementsPrimitives( | ||
| skontoSectionTitleTextColor = Color(context.getColor(R.color.skonto_section_title_text_color)), | ||
| ) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,8 @@ data class GiniColorScheme( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val checkbox: Checkbox = Checkbox(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val contextMenu: ContextMenu = ContextMenu(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val logo: Logo = Logo(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val skontoSection: SkontoSection = SkontoSection() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Binary-compatibility secondary constructor matching the previous signature (without skontoSection) | |
| constructor( | |
| background: Background = Background(), | |
| bottomBar: BottomBar = BottomBar(), | |
| topAppBar: TopAppBar = TopAppBar(), | |
| placeholder: Placeholder = Placeholder(), | |
| text: Text = Text(), | |
| card: Card = Card(), | |
| badge: Badge = Badge(), | |
| button: Button = Button(), | |
| buttonOutlined: ButtonOutlined = ButtonOutlined(), | |
| progressBarButton: ProgressBarButton = ProgressBarButton(), | |
| textField: TextField = TextField(), | |
| toggles: Toggles = Toggles(), | |
| dialogs: Dialogs = Dialogs(), | |
| icons: Icons = Icons(), | |
| datePicker: DatePicker = DatePicker(), | |
| checkbox: Checkbox = Checkbox(), | |
| contextMenu: ContextMenu = ContextMenu(), | |
| logo: Logo = Logo(), | |
| ) : this( | |
| background = background, | |
| bottomBar = bottomBar, | |
| topAppBar = topAppBar, | |
| placeholder = placeholder, | |
| text = text, | |
| card = card, | |
| badge = badge, | |
| button = button, | |
| buttonOutlined = buttonOutlined, | |
| progressBarButton = progressBarButton, | |
| textField = textField, | |
| toggles = toggles, | |
| dialogs = dialogs, | |
| icons = icons, | |
| datePicker = datePicker, | |
| checkbox = checkbox, | |
| contextMenu = contextMenu, | |
| logo = logo, | |
| skontoSection = SkontoSection(), | |
| ) |
Copilot
AI
Feb 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property name skontoSectionTitleTextColor inside SkontoSection is redundant/inconsistent with the rest of GiniColorScheme (e.g., Text.primary, Logo.tint). Renaming it to something like titleTextColor would avoid the skontoSection.skontoSectionTitleTextColor repetition and make the API easier to read.
| val skontoSectionTitleTextColor: Color = Color.Unspecified, | |
| val titleTextColor: Color = Color.Unspecified, |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,7 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> | ||||||
| <resources> | ||||||
|
|
||||||
| <color name="gc_camera_title_color">@color/gc_light_01</color> | ||||||
| <color name="skonto_section_title_text_color">@color/gc_dark_02</color> | ||||||
|
||||||
| <color name="skonto_section_title_text_color">@color/gc_dark_02</color> | |
| <color name="skonto_section_title_text_color">@color/gc_light_01</color> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The KDoc for
buildColorPrimitivesBasedOnResources()says the values come fromres/colors.xml, but these element overrides are defined inres/values/element_colors.xml(and may also be overridden elsewhere). Updating the comment would prevent confusion for anyone trying to override the resources.