src/docs/filter-hue-rotate.mdx
import { ApiTable } from "@/components/api-table.tsx"; import { Example } from "@/components/example.tsx"; import { Figure } from "@/components/figure.tsx"; import { ResponsiveDesign, UsingACustomValue } from "@/components/content.tsx";
export const title = "filter: hue-rotate()"; export const description = "Utilities for applying hue-rotate filters to an element.";
<ApiTable rows={[ ["hue-rotate-<number>", "filter: hue-rotate(<number>deg);"], ["-hue-rotate-<number>", "filter: hue-rotate(calc(<number>deg * -1));"], ["hue-rotate-(<custom-property>)", "filter: hue-rotate(var(<custom-property>));"], ["hue-rotate-[<value>]", "filter: hue-rotate(<value>);"], ]} />
Use utilities like hue-rotate-90 and hue-rotate-180 to rotate the hue of an element by degrees:
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
<div className="flex shrink-0 flex-col items-center">
<p className="mb-3 text-center font-mono text-xs font-medium text-gray-500 dark:text-gray-400">
hue-rotate-90
</p>
<div className="relative hue-rotate-90">
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
<div className="flex shrink-0 flex-col items-center">
<p className="mb-3 text-center font-mono text-xs font-medium text-gray-500 dark:text-gray-400">
hue-rotate-180
</p>
<div className="relative hue-rotate-180">
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
<div className="flex shrink-0 flex-col items-center">
<p className="mb-3 text-center font-mono text-xs font-medium text-gray-500 dark:text-gray-400">
hue-rotate-270
</p>
<div className="relative hue-rotate-270">
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
</div>
</div>
} </Example>
<!-- [!code classes:hue-rotate-15,hue-rotate-90,hue-rotate-180,hue-rotate-270] -->
Use utilities like -hue-rotate-15 and -hue-rotate-45 to set a negative hue rotate value:
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
<div className="flex shrink-0 flex-col items-center">
<p className="mb-3 text-center font-mono text-xs font-medium text-gray-500 dark:text-gray-400">
-hue-rotate-45
</p>
<div className="relative -hue-rotate-45">
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
<div className="flex shrink-0 flex-col items-center">
<p className="mb-3 text-center font-mono text-xs font-medium text-gray-500 dark:text-gray-400">
-hue-rotate-90
</p>
<div className="relative -hue-rotate-90">
<div className="absolute inset-0 rounded-lg ring-1 ring-black/10 ring-inset"></div>
</div>
</div>
</div>
</div>
} </Example>
<!-- [!code classes:-hue-rotate-15,-hue-rotate-45,-hue-rotate-90] -->
<UsingACustomValue element="img" elementAttributes={{ src: "/img/mountains.jpg" }} utility="hue-rotate" value="3.142rad" name="hue rotation" />
<ResponsiveDesign element="img" elementAttributes={{ src: "/img/mountains.jpg" }} property="filter: hue-rotate()" defaultClass="hue-rotate-60" featuredClass="hue-rotate-0" />