{"id":5431,"date":"2025-03-20T08:33:51","date_gmt":"2025-03-20T13:33:51","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=5431"},"modified":"2025-03-20T08:33:52","modified_gmt":"2025-03-20T13:33:52","slug":"relative-colors","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/relative-colors\/","title":{"rendered":"Relative Colors"},"content":{"rendered":"\n<p>I love the idea of being able to take a color you already have in CSS, like <code>currentColor<\/code>, a custom property, or a color pulled from an <code>attr()<\/code>, and manipulate it. The big examples being darken, lighten, or apply opacity to it for different adjacent elements or states. <\/p>\n\n\n\n<p>We have a <em>ton<\/em> of <a href=\"https:\/\/webstatus.dev\/features\/relative-color\">&#8220;newly available&#8221;<\/a> power in CSS with this in the form of the <a href=\"https:\/\/frontendmasters.com\/blog\/relative-color-syntax-basic-use-cases\/\">relative color syntax<\/a>, and <a href=\"https:\/\/ishadeed.com\/article\/css-relative-colors\/#css-relative-colors-syntax\">Ahmad&#8217;s new post about this is great<\/a>. The <code>color-mix()<\/code> function has a bit better browser support and has a good amount of overlap in what it can do, but I prefer the syntax and power of the relative color syntax. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I love the idea of being able to take a color you already have in CSS, like currentColor, a custom property, or a color pulled from an attr(), and manipulate it. The big examples being darken, lighten, or apply opacity to it for different adjacent elements or states. We have a ton of &#8220;newly available&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5432,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[81,305,7,225],"class_list":["post-5431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-color","tag-color-mix-2","tag-css","tag-relative-color-syntax"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/03\/shadows-from-rcs.png?fit=1036%2C528&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=5431"}],"version-history":[{"count":1,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5431\/revisions"}],"predecessor-version":[{"id":5433,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5431\/revisions\/5433"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/5432"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=5431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=5431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=5431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}