# \fcolorbox

Places text, optionally with inline math, in a framed box with separate frame and background colors to call out a result or warning; optional model arguments give each color numerically, and the background model defaults to the frame model.

https://texform.dev/latex/commands/fcolorbox

## Metadata

| Field | Value |
| --- | --- |
| Packages | color |
| Allowed mode | both |
| Tags | presentation |
| Commonality | low |
| Kind | prefix |

## Syntax

### color

Argument specification: `o:N m:N o:N m:N m:T`

Places text, optionally with inline math, in a framed box with separate frame and background colors to call out a result or warning; optional model arguments give each color numerically, and the background model defaults to the frame model.

## Examples

```latex
\fcolorbox{red}{yellow}{check}
```

[Open in Playground](https://play.texform.dev/?input=%5Cfcolorbox%7Bred%7D%7Byellow%7D%7Bcheck%7D)

```latex
\fcolorbox{blue}{white}{$E = mc^2$}
```

[Open in Playground](https://play.texform.dev/?input=%5Cfcolorbox%7Bblue%7D%7Bwhite%7D%7B%24E+%3D+mc%5E2%24%7D)

```latex
\fcolorbox[rgb]{0.8,0,0}{1,1,0.8}{$a + b$}
```

[Open in Playground](https://play.texform.dev/?input=%5Cfcolorbox%5Brgb%5D%7B0.8%2C0%2C0%7D%7B1%2C1%2C0.8%7D%7B%24a+%2B+b%24%7D)

```latex
\fcolorbox[RGB]{200,0,0}[gray]{0.95}{$x$ is fixed}
```

[Open in Playground](https://play.texform.dev/?input=%5Cfcolorbox%5BRGB%5D%7B200%2C0%2C0%7D%5Bgray%5D%7B0.95%7D%7B%24x%24+is+fixed%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| color | full | partial | full |

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

## Test cases

### color

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \fcolorbox{red}{yellow}{a} | Positive: baseline | Pass | Pass | Pass |
| \fcolorbox[rgb]{1,0,0}{1,1,0}{a} | Positive: vary:o[0] | Pass | Fail | Pass |
| \fcolorbox{red}[gray]{0.85}{a} | Positive: vary:o[2] | Pass | Fail | Pass |
| \fcolorbox[rgb]{1,0,0}[gray]{0.85}{a} | Positive: maximal | Pass | Fail | Pass |
| \fcolorbox{red}{yellow}a | Positive: bare[4] | Pass | Pass | Pass |
| \fcolorbox[\alpha]{1,0,0}{1,1,0}{a} | Negative: neg:N[0] | Fail | Fail | Fail |
| \fcolorbox{\alpha}{yellow}{a} | Negative: neg:N[1] | Pass | Fail | Fail |
| \fcolorbox{red}[\alpha]{0.85}{a} | Negative: neg:N[2] | Fail | Fail | Fail |
| \fcolorbox{red}{\alpha}{a} | Negative: neg:N[3] | Pass | Fail | Fail |
| \fcolorbox{red}{yellow}{a^2} | Negative: neg:T[4] | Pass | Fail | Fail |
