> For the complete documentation index, see [llms.txt](https://spectrecss.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spectrecss.angular-package.dev/function/color/color-name.md).

# color-name()

{% code title="" lineNumbers="true" %}

```scss
@function color-name($name) {
  @if string.length($name) > 0 {
    @if string.index($name, '-') == null {
      $name: string.insert($name, '-color', string.length($name) + 1);
    } @else if string.index($name, 'color') == null {
      @if string.index($name, 'dark') != null {
        $name: #{string.insert(string.slice($name, 1, string.index($name, 'dark') - 1), 'color-dark', string.index($name, 'dark'))};
      } @else if string.index($name, 'light') != null {
        $name: #{string.insert(string.slice($name, 1, string.index($name, 'light') - 1), 'color-light', string.index($name, 'light'))};
      } @else {
        $name: string.insert($name, '-color', string.length($name) + 1);
      }
    }
  }
  @return $name;
}
```

{% endcode %}
