关于「对比度的精确算术:sRGB 线性化、暗色主题与高对比主题」,《客群分化界面与同价同条款》给出的定量结论是什么?

结论:第三章逐位计算 sRGB 相对亮度与对比度,暗色时尚版的装饰灰只有 3.55,须调亮;新旧线性化阈值在全部 8 位颜色上不改变任何判定。

数据口径:书中参数为示意,全部计算由书中程序生成,不对应任何真实站点;非法律建议,非个人化经营建议。 第五章说明选择过载是有条件的效应:示意合并均值接近零,新情境的预测区间却从 -0.5195 到 +0.6687;筛选加买家自选排序让比较楼盘快 5.69 倍。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 3.55

pair fg bg ratio AA-4.5 large-3
elder body#1A1A1A #FFFFFF17.40passpass
elder button#FFFFFF #0B53947.84passpass
fashion body dark#E8E8F0 #12121815.31passpass
fashion accent btn#121218 #7CF5C413.96passpass
fashion grey hint#6B6B78 #1212183.55rejectpass
property body#1F2933 #F5F7FA13.75passpass
property link#0B5CAD #FFFFFF6.67passpass
narrative body#F2E9DC #2B211813.10passpass
default muted#9AA0A6 #FFFFFF2.64rejectreject
black on white: 21.00
查看完整验算程序
# Chapter 3. p31: WCAG 2.2 relative luminance and contrast ratio, exact.
# Channel c in [0, 1]: linear = c / 12.92 if c <= 0.04045, otherwise
# ((c + 0.055) / 1.055) ** 2.4; L = 0.2126 R + 0.7152 G + 0.0722 B;
# ratio = (L1 + 0.05) / (L2 + 0.05) with L1 the lighter colour.
# Bars: 4.5 normal text, 3.0 large text (18 pt, or 14 pt bold).
# Colour pairs are the book's own illustrations for five templates;
# rows marked "reject" are shown only to be recognised and refused.
import math


def lin(c8):
    c = c8 / 255.0
    return c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4


def lum(hexrgb):
    r, g, b = (int(hexrgb[i:i + 2], 16) for i in (1, 3, 5))
    return math.fsum([0.2126 * lin(r), 0.7152 * lin(g), 0.0722 * lin(b)])


def ratio(fg, bg):
    a, b = lum(fg), lum(bg)
    hi, lo = max(a, b), min(a, b)
    return (hi + 0.05) / (lo + 0.05)


PAIRS = [
    ("elder body", "#1A1A1A", "#FFFFFF"),
    ("elder button", "#FFFFFF", "#0B5394"),
    ("fashion body dark", "#E8E8F0", "#121218"),
    ("fashion accent btn", "#121218", "#7CF5C4"),
    ("fashion grey hint", "#6B6B78", "#121218"),
    ("property body", "#1F2933", "#F5F7FA"),
    ("property link", "#0B5CAD", "#FFFFFF"),
    ("narrative body", "#F2E9DC", "#2B2118"),
    ("default muted", "#9AA0A6", "#FFFFFF"),
]
print("pair                 fg       bg       ratio   AA-4.5  large-3")
for name, fg, bg in PAIRS:
    r = ratio(fg, bg)
    a = "pass" if r >= 4.5 else "reject"
    l3 = "pass" if r >= 3.0 else "reject"
    print("{:<19} {} {}  {:>6.2f}   {:<6}  {}".format(
        name, fg, bg, r, a, l3))
print("black on white: {:.2f}".format(ratio("#000000", "#FFFFFF")))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《客群认知画像分层、适老与新世代界面分化及千人千面转化交互母典》第 3 章「对比度的精确算术:sRGB 线性化、暗色主题与高对比主题」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-363 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026363,
  author    = {Fan, Yafu},
  title     = {Demographic Cognitive Segmentation, Elder-to-Gen-Z Interface Divergence and Audience-Adaptive Conversion UX},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论