> For the complete documentation index, see [llms.txt](https://imgo.gitbook.io/cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://imgo.gitbook.io/cn/api/color2hex.md).

# Color2Hex

颜色转十六进制。

## 参数

<table><thead><tr><th>参数名</th><th width="208.18338610093963">类型</th><th>说明</th></tr></thead><tbody><tr><td>c</td><td><code>color.Color</code></td><td>颜色</td></tr></tbody></table>

## 返回值

string

## 例子

```go
package main

import (
    "fmt"
    "github.com/fishtailstudio/imgo"
    "image/color"
)

func main() {
    fmt.Println(imgo.Color2Hex(color.White))
}
```

输出：

```
#FFFFFF
```
