SparkColors

class SparkColors(accent: Color, onAccent: Color, accentContainer: Color, onAccentContainer: Color, accentVariant: Color, onAccentVariant: Color, basic: Color, onBasic: Color, basicContainer: Color, onBasicContainer: Color, main: Color, onMain: Color, mainContainer: Color, onMainContainer: Color, mainVariant: Color, onMainVariant: Color, support: Color, onSupport: Color, supportContainer: Color, onSupportContainer: Color, supportVariant: Color, onSupportVariant: Color, success: Color, onSuccess: Color, successContainer: Color, onSuccessContainer: Color, alert: Color, onAlert: Color, alertContainer: Color, onAlertContainer: Color, error: Color, onError: Color, errorContainer: Color, onErrorContainer: Color, info: Color, onInfo: Color, infoContainer: Color, onInfoContainer: Color, neutral: Color, onNeutral: Color, neutralContainer: Color, onNeutralContainer: Color, background: Color, onBackground: Color, backgroundVariant: Color, onBackgroundVariant: Color, surface: Color, onSurface: Color, surfaceInverse: Color, onSurfaceInverse: Color, surfaceTint: Color, outline: Color, outlineHigh: Color, scrim: Color, dimContent1: Float, dimContent2: Float, dimContent3: Float, dimContent4: Float, dimContent5: Float)

A color scheme holds all the named color parameters for a SparkTheme highly inspired by Material 3 ColorScheme.

SparkColors are designed to be harmonious, ensure accessible text, and distinguish UI elements and surfaces from one another. There are two built-in baseline schemes, lightSparkColors and a darkSparkColors, that can be used as-is or customized.

To learn more about colors, see Material Design colors and Spark colors.

Constructors

Link copied to clipboard
constructor(accent: Color, onAccent: Color, accentContainer: Color, onAccentContainer: Color, accentVariant: Color, onAccentVariant: Color, basic: Color, onBasic: Color, basicContainer: Color, onBasicContainer: Color, main: Color, onMain: Color, mainContainer: Color, onMainContainer: Color, mainVariant: Color, onMainVariant: Color, support: Color, onSupport: Color, supportContainer: Color, onSupportContainer: Color, supportVariant: Color, onSupportVariant: Color, success: Color, onSuccess: Color, successContainer: Color, onSuccessContainer: Color, alert: Color, onAlert: Color, alertContainer: Color, onAlertContainer: Color, error: Color, onError: Color, errorContainer: Color, onErrorContainer: Color, info: Color, onInfo: Color, infoContainer: Color, onInfoContainer: Color, neutral: Color, onNeutral: Color, neutralContainer: Color, onNeutralContainer: Color, background: Color, onBackground: Color, backgroundVariant: Color, onBackgroundVariant: Color, surface: Color, onSurface: Color, surfaceInverse: Color, onSurfaceInverse: Color, surfaceTint: Color, outline: Color, outlineHigh: Color, scrim: Color, dimContent1: Float, dimContent2: Float, dimContent3: Float, dimContent4: Float, dimContent5: Float)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

An emphasis color used to provide a warning feedback.

Link copied to clipboard

The preferred tonal color of warning containers.

Link copied to clipboard

The background color that appears behind scrollable content.

Link copied to clipboard

The background color that appears behind scrollable content.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var dim1: Float

An alpha used to apply a medium emphasis to text.

Link copied to clipboard
var dim2: Float

An alpha used to apply a medium emphasis to icons.

Link copied to clipboard
var dim3: Float

An alpha used to apply a disabled emphasis to all components.

Link copied to clipboard
var dim4: Float

An alpha used to show a low element.

Link copied to clipboard
var dim5: Float

An alpha used to apply a pressed/ripple visual but should not be used on Android.

Link copied to clipboard

The error color is used to indicate errors in components, such as invalid text in a text field.

Link copied to clipboard

The preferred tonal color of error containers.

Link copied to clipboard
var info: Color

An emphasis color used to provide an informative feedback.

Link copied to clipboard

The preferred tonal color of info containers.

Link copied to clipboard
var main: Color

The main color is the color displayed most frequently across your app’s screens and components.

Link copied to clipboard

The preferred tonal color of containers.

Link copied to clipboard

Darker variation of main color.

Link copied to clipboard

An emphasis color used to provide a neutral feedback.

Link copied to clipboard

The preferred tonal color of neutral containers.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Color used for text and icons displayed on top of the alert color.

Link copied to clipboard

Color used for text and icons displayed on top of the alertContainer color.

Link copied to clipboard

Color used for text and icons displayed on top of the background color.

Link copied to clipboard

Color used for text and icons displayed on top of the background color.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Color used for text and icons displayed on top of the error color.

Link copied to clipboard

The color (and state variants) that should be used for content on top of errorContainer.

Link copied to clipboard

Color used for text and icons displayed on top of the info color.

Link copied to clipboard

Color used for text and icons displayed on top of the infoContainer color.

Link copied to clipboard

Color used for text and icons displayed on top of the main color.

Link copied to clipboard

The color (and state variants) that should be used for content on top of mainContainer.

Link copied to clipboard

Color used for text and icons displayed on top of the mainVariant color.

Link copied to clipboard

Color used for text and icons displayed on top of the neutral color.

Link copied to clipboard

Color used for text and icons displayed on top of the neutralContainer color.

Link copied to clipboard

Color used for text and icons displayed on top of the success color.

Link copied to clipboard

Color used for text and icons displayed on top of the successContainer color.

Link copied to clipboard

Color used for text and icons displayed on top of the support color.

Link copied to clipboard

The color (and state variants) that should be used for content on top of supportContainer.

Link copied to clipboard

Color used for text and icons displayed on top of the supportVariant color.

Link copied to clipboard

Color used for text and icons displayed on top of the surface color.

Link copied to clipboard
Link copied to clipboard

Subtle color used for boundaries. Outline color role adds contrast for accessibility purposes.

Link copied to clipboard

Utility color used for boundaries for decorative elements when strong contrast is not required.

Link copied to clipboard

Color of a scrim that obscures content. On Android platforms, the scrim color and opacity is automatically handled by the system UI.

Link copied to clipboard

An emphasis color used to provide a positive feedback.

Link copied to clipboard

The preferred tonal color of success containers.

Link copied to clipboard

The support color provides more ways to accent and distinguish your product. Support colors are best for:

Link copied to clipboard

A tonal color to be used in containers.

Link copied to clipboard

Darker variation of support color.

Link copied to clipboard

The surface color that affect surfaces of components, such as cards, sheets, and menus.

Link copied to clipboard

Functions

Link copied to clipboard
fun SparkColors.applyTonalElevation(backgroundColor: Color, elevation: Dp): Color

Returns the new background Color to use, representing the original background color with an overlay corresponding to elevation applied. The overlay will only be applied to ColorScheme.surface.

Link copied to clipboard
fun SparkColors.contentColorFor(backgroundColor: Color): Color

The Material color system contains pairs of colors that are typically used for the background and content color inside a component. For example, a ButtonFilled typically uses main for its background, and onMain for the color of its content (usually text or iconography).

Link copied to clipboard
fun copy(accent: Color = this.accent, onAccent: Color = this.onAccent, accentContainer: Color = this.accentContainer, onAccentContainer: Color = this.onAccentContainer, accentVariant: Color = this.accentVariant, onAccentVariant: Color = this.onAccentVariant, basic: Color = this.basic, onBasic: Color = this.onBasic, basicContainer: Color = this.basicContainer, onBasicContainer: Color = this.onBasicContainer, main: Color = this.main, onMain: Color = this.onMain, mainContainer: Color = this.mainContainer, onMainContainer: Color = this.onMainContainer, mainVariant: Color = this.mainVariant, onMainVariant: Color = this.onMainVariant, support: Color = this.support, onSupport: Color = this.onSupport, supportContainer: Color = this.supportContainer, onSupportContainer: Color = this.onSupportContainer, supportVariant: Color = this.supportVariant, onSupportVariant: Color = this.onSupportVariant, background: Color = this.background, onBackground: Color = this.onBackground, backgroundVariant: Color = this.backgroundVariant, onBackgroundVariant: Color = this.onBackgroundVariant, surface: Color = this.surface, onSurface: Color = this.onSurface, surfaceInverse: Color = this.surfaceInverse, onSurfaceInverse: Color = this.onSurfaceInverse, surfaceTint: Color = this.surfaceTint, outline: Color = this.outline, outlineHigh: Color = this.outlineHigh, scrim: Color = this.scrim, success: Color = this.success, onSuccess: Color = this.onSuccess, successContainer: Color = this.successContainer, onSuccessContainer: Color = this.onSuccessContainer, alert: Color = this.alert, onAlert: Color = this.onAlert, alertContainer: Color = this.alertContainer, onAlertContainer: Color = this.onAlertContainer, error: Color = this.error, onError: Color = this.onError, errorContainer: Color = this.errorContainer, onErrorContainer: Color = this.onErrorContainer, info: Color = this.info, onInfo: Color = this.onInfo, infoContainer: Color = this.infoContainer, onInfoContainer: Color = this.onInfoContainer, neutral: Color = this.neutral, onNeutral: Color = this.onNeutral, neutralContainer: Color = this.neutralContainer, onNeutralContainer: Color = this.onNeutralContainer, dimContent1: Float = this.dim1, dimContent2: Float = this.dim2, dimContent3: Float = this.dim3, dimContent4: Float = this.dim4, dimContent5: Float = this.dim5): SparkColors

Returns a copy of this Colors, optionally overriding some of the values.

Link copied to clipboard

Computes the surface tonal color at different elevation levels e.g. surface1 through surface5.

Link copied to clipboard
open override fun toString(): String