@function get-contrast-color($bg-color) {
    /* This function takes $bg-color and returns either white or black color as
    the beset contrast color for text, based on the lightness of the background color */

    // Extract the lightness component
    $lightness: lightness($bg-color);

    // Check if the background color is lime-green or yellow and return dark color
    @if $bg-color == $lime-green or $bg-color == map-get($base-color-palette, "yellow") {
        @return $dark;
    }

    // Check the brightness to return the best contrast color
    @if $lightness < 55 {
        @return $light;
    } @else {
        @return $dark;
    }
}


@function get-hover-color($color) {
    /* This function takes a color and returns either a lighter
    or darker shade based on its brightness. */

    // Extract the lightness component
    $lightness: lightness($color);

    // Check the brightness and return either a darker or lighter color
    @if $lightness < 55 {
        @return lighten($color, 10);
    } @else {
        @return darken($color, 10);
    }
}


@function generate-shade($color, $percentage, $direction) {
    // Function to generate lightened or darkened shade based on parameters

    // Check if the direction is 'lighten', apply the lighten function
    @if $direction == 'lighten' {
        @return mix(white, $color, $percentage);
    }

    // Check if the direction is 'darken', apply the darken function
    @else if $direction == 'darken' {
        @return mix(black, $color, $percentage);
    }

    // Error handling if an invalid direction is provided
    @else {
        @error "Invalid direction! Use 'lighten' or 'darken'.";
    }
}
