// ============================================================================
// Poster
// ============================================================================

////
///
/// Filter Functions Module
/// ===========================================================================
///
///
/// @group Filter
/// @author Scape Agency
/// @link https://hue.gl
/// @since 0.1.0 initial release
/// @todo None
/// @access public
///
////


// ============================================================================
// Use
// ============================================================================

@use "sass:math";

@use "../variables" as *;
@use "../maps" as *;

// ============================================================================
// Functions
// ============================================================================



///
/// Color Filter Function
/// ---------------------------------------------------------------------------
///
/// Applies a CSS filter effect to a color. Supported filters include 'sepia'
/// and 'brightness'.
///
/// @name hue_apply_filter
/// @param {String} $color_name - The name of the color in the color map.
/// @param {String} $filter - The type of filter to apply ('sepia' or 'brightness').
/// @return {Color} - The color with the filter effect applied, or the original color if the filter is unsupported.
/// @throws - If the color name does not exist in the map, or if the filter type is unsupported.
///
/// @example scss - Applying a sepia filter
///   .image-sepia {
///     color: hue_apply_filter('oceanblue', 'sepia');
///   }
///
/// @example scss - Applying a brightness filter
///   .image-bright {
///     color: hue_apply_filter('skyblue', 'brightness');
///   }
///
/// @example scss - Using an unsupported filter
///   .image-unsupported {
///     color: hue_apply_filter('forestgreen', 'blur');
///   }
///
@function hue_apply_filter($color_name, $filter: 'sepia') {
    $color: hue_color($color_name);

    @if type-of($color) != 'color' {
        @warn "The specified color `#{$color_name}` could not be found.";
        @return null;
    }

    @if $filter == 'sepia' {
        @return sepia($color);
    } @else if $filter == 'brightness' {
        // Assumes brightness function accepts a color and a percentage
        @return brightness($color, 150%);
    } @else {
        @warn "The specified filter `#{$filter}` is not supported.";
        @return $color;
    }
}
