/* * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CPP_CAM_HCT_H_ #define CPP_CAM_HCT_H_ #include "cpp/utils/utils.h" namespace material_color_utilities { /** * HCT: hue, chroma, and tone. * * A color system built using CAM16 hue and chroma, and L* (lightness) from * the L*a*b* color space, providing a perceptually accurate * color measurement system that can also accurately render what colors * will appear as in different lighting environments. * * Using L* creates a link between the color system, contrast, and thus * accessibility. Contrast ratio depends on relative luminance, or Y in the XYZ * color space. L*, or perceptual luminance can be calculated from Y. * * Unlike Y, L* is linear to human perception, allowing trivial creation of * accurate color tones. * * Unlike contrast ratio, measuring contrast in L* is linear, and simple to * calculate. A difference of 40 in HCT tone guarantees a contrast ratio >= 3.0, * and a difference of 50 guarantees a contrast ratio >= 4.5. */ class Hct { … }; } // namespace material_color_utilities #endif // CPP_CAM_HCT_H_