@use 'sass:meta';

@use '../color_schemes/base_colors';
@use '../color_schemes/researcher_light_colors';
@use '../color_schemes/researcher_dark_colors';
@use '../color_schemes/bandit_light_colors';
@use '../color_schemes/bandit_dark_colors';

$-particle-colors-map: (
  'base': meta.module-variables(base_colors),
  'researcher-light': researcher_light_colors.$colors,
  'researcher-dark': researcher_dark_colors.$colors,
  'bandit-light': bandit_light_colors.$colors,
  'bandit-dark': bandit_dark_colors.$colors,
);

/*
* The `get-color` function allows consuming stylesheets to reference a
* Particle color value via Sass. This provides an escape hatch for consuming
* applications that need to generate derivative colors via Sass color functions.
*                                                                         
* In the vast majority of cases this should not be necessary. Consuming
* applications can either use CSS variables for a preexisting shade of a color
* or they can use the `-rgb` variant of a given color to apply opacity.
*/

@function get-color($color, $theme: 'base') {
  @return map-get($-particle-colors-map, $theme, 'color--#{$color}');
}

@function extract-rgb($color) {
  @return red($color), green($color), blue($color);
}
