All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.github.lyxnx.compose.pine.SwitchDefaults.kt Maven / Gradle / Ivy

package io.github.lyxnx.compose.pine

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import io.github.lyxnx.compose.ui.AnimatedInteractionStateColorSelector

/**
 * Contains the default values used by a [Switch]
 */
public object SwitchDefaults {

    /**
     * Creates a [SwitchColors] instance that represents the colors in different states
     */
    @Composable
    public fun switchColors(
        unselectedTrackColor: Color = PineTheme.colors.grey200,
        pressedUnselectedTrackColor: Color = PineTheme.colors.grey300,
        focusedUnselectedTrackColor: Color = PineTheme.colors.grey200,
        disabledUnselectedTrackColor: Color = PineTheme.colors.grey300,
        selectedTrackColor: Color = PineTheme.colors.success500,
        pressedSelectedTrackColor: Color = PineTheme.colors.success400,
        focusedSelectedTrackColor: Color = PineTheme.colors.success400,
        disabledSelectedTrackColor: Color = PineTheme.colors.grey300,
        unselectedTrackBorderColor: Color = PineTheme.colors.grey200,
        pressedUnselectedTrackBorderColor: Color = PineTheme.colors.grey300,
        focusedUnselectedTrackBorderColor: Color = PineTheme.colors.grey200,
        disabledUnselectedTrackBorderColor: Color = PineTheme.colors.grey300,
        selectedTrackBorderColor: Color = PineTheme.colors.success500,
        pressedSelectedTrackBorderColor: Color = PineTheme.colors.success400,
        focusedSelectedTrackBorderColor: Color = PineTheme.colors.success400,
        disabledSelectedTrackBorderColor: Color = PineTheme.colors.grey300,
        selectedThumbColor: Color = PineTheme.colors.background,
        pressedSelectedThumbColor: Color = PineTheme.colors.background,
        focusedSelectedThumbColor: Color = PineTheme.colors.background,
        disabledSelectedThumbColor: Color = PineTheme.colors.grey400,
        selectedThumbBorderColor: Color = PineTheme.colors.background,
        pressedSelectedThumbBorderColor: Color = PineTheme.colors.background,
        focusedSelectedThumbBorderColor: Color = PineTheme.colors.background,
        disabledSelectedThumbBorderColor: Color = PineTheme.colors.grey400,
        unselectedThumbColor: Color = PineTheme.colors.background,
        pressedUnselectedThumbColor: Color = PineTheme.colors.background,
        focusedUnselectedThumbColor: Color = PineTheme.colors.background,
        disabledUnselectedThumbColor: Color = PineTheme.colors.grey400,
        unselectedThumbBorderColor: Color = PineTheme.colors.background,
        pressedUnselectedThumbBorderColor: Color = PineTheme.colors.success500,
        focusedUnselectedThumbBorderColor: Color = PineTheme.colors.background,
        disabledUnselectedThumbBorderColor: Color = PineTheme.colors.grey400,
        unselectedFocusedShadowColor: Color = PineTheme.colors.grey600.copy(alpha = 0.25f),
        selectedFocusedShadowColor: Color = PineTheme.colors.success600.copy(alpha = 0.25f)
    ): SwitchColors = SwitchColors(
        unselectedTrackColor = AnimatedInteractionStateColorSelector(
            default = unselectedTrackColor,
            pressed = pressedUnselectedTrackColor,
            focused = focusedUnselectedTrackColor,
            disabled = disabledUnselectedTrackColor
        ),
        selectedTrackColor = AnimatedInteractionStateColorSelector(
            default = selectedTrackColor,
            pressed = pressedSelectedTrackColor,
            focused = focusedSelectedTrackColor,
            disabled = disabledSelectedTrackColor
        ),
        unselectedTrackBorderColor = AnimatedInteractionStateColorSelector(
            default = unselectedTrackBorderColor,
            pressed = pressedUnselectedTrackBorderColor,
            focused = focusedUnselectedTrackBorderColor,
            disabled = disabledUnselectedTrackBorderColor
        ),
        selectedTrackBorderColor = AnimatedInteractionStateColorSelector(
            default = selectedTrackBorderColor,
            pressed = pressedSelectedTrackBorderColor,
            focused = focusedSelectedTrackBorderColor,
            disabled = disabledSelectedTrackBorderColor
        ),
        selectedThumbColor = AnimatedInteractionStateColorSelector(
            default = selectedThumbColor,
            pressed = pressedSelectedThumbColor,
            focused = focusedSelectedThumbColor,
            disabled = disabledSelectedThumbColor
        ),
        selectedThumbBorderColor = AnimatedInteractionStateColorSelector(
            default = selectedThumbBorderColor,
            pressed = pressedSelectedThumbBorderColor,
            focused = focusedSelectedThumbBorderColor,
            disabled = disabledSelectedThumbBorderColor
        ),
        unselectedThumbColor = AnimatedInteractionStateColorSelector(
            default = unselectedThumbColor,
            pressed = pressedUnselectedThumbColor,
            focused = focusedUnselectedThumbColor,
            disabled = disabledUnselectedThumbColor
        ),
        unselectedThumbBorderColor = AnimatedInteractionStateColorSelector(
            default = unselectedThumbBorderColor,
            pressed = pressedUnselectedThumbBorderColor,
            focused = focusedUnselectedThumbBorderColor,
            disabled = disabledUnselectedThumbBorderColor
        ),
        unselectedFocusedShadowColor = unselectedFocusedShadowColor,
        selectedFocusedShadowColor = selectedFocusedShadowColor
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy