关于「方法:多站视觉漂移的三个量、证据分级与《营造法式》材分制」,《跨站设计令牌与感知色彩》给出的定量结论是什么?

结论:第一章定下全书样本:虚构品牌集团衡宇的 30 个站点里,四个家族的主色在线上变成了 16 种,24 个站点有角色超出 ΔE00 不超过 2.0 的容差,9,400 条颜色声明里写死的有 2,210 条;偏离率与色差的等级相关只有 0.608;在好看与可信无关时,最好看的方案同时最可信的概率只有 0.202。第二至第七章依次写令牌图、颜色算术、感知色阶、第一印象研究、多站治理,以及四类站点的手册与样式库规格。

数据口径:多站视觉漂移用令牌偏离数、色差与第一印象评分三个量描述,不合成总分;证据分为五级,每一次统一工程预先登记十项内容。 全部品牌、站点、颜色与评分都是虚构样本,全部计算由书中程序生成;涉及法规之处只写一般框架,不是法律意见。

English version

对照数据表

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

Sharma et al. (2005) pairs 1 and 17 reproduced: 2.0425, 27.1492
shared:accent #B8913Ftext #1B1B20muted #6B6B76surface #F7F5F0border #E4E2DC
primary: boutique #8C2F39report #1F5FA8course #2E7D5Bcard #6B4FA0
site builderprimarydE00(pri)worst roleworst dE00roles>2.0declharddev.rate
B01agency#8C2F390.00surface1.370165700.424
B02in-house#8C2F390.00muted6.851367460.125
B03in-house#7D323F4.50primary4.502180180.100
B04agency#8C2F390.00muted3.9214431380.312
B05agency#7833488.28border9.932228720.316
B06in-house#8C2F390.00text3.401191270.141
B07in-house#8630361.50primary1.500430620.144
B08template#900A0512.27text14.8843331250.375
R01agency#1F5FA80.00border4.372239720.301
R02agency#114F915.75primary5.7513361210.360
R03in-house#1F5FA80.00border3.381346400.116
R04agency#4E67B67.10primary7.103220940.427
R05in-house#1F5FA80.00primary0.000319380.119
R06template#4061B04.68text5.8333762520.670
R07in-house#2561B62.13border4.102454680.150
R08in-house#1F5FA80.00accent3.101408580.142
C01agency#55836F7.41text8.033279790.283
C02in-house#2E7D5B0.00muted6.101152190.125
C03agency#5087716.99muted7.3633941660.421
C04in-house#3378532.35primary2.351446570.128
C05in-house#2E7D5B0.00primary0.000242240.099
C06in-house#2E7D5B0.00surface2.511402480.119
C07in-house#2E7D5B0.00accent2.621217180.083
K01in-house#6B4FA00.00primary0.000449340.076
查看完整验算程序
# Chapter 1. p10: The book-wide sample - Hengyu's 30 sites, their drifted colours and token deviations.
# Everything here is invented. Hengyu is a fictional brand group. Shared roles use the Hengyu primitives
# (gold.500, ink.900, ink.500, ink.050, ink.100); the primary is the family brand of the site. Each
# site's "live" colours are drawn from a seeded drift model (seed 140); nothing here is measured.
# Drift model: a site built by builder X keeps a role bound to its token with probability KEEP[X];
# otherwise the role's colour is moved in OKLCH by Gaussian steps scaled by SPREAD[X].
# Colour difference: CIEDE2000 on CIELAB (D65), as in Sharma, Wu & Dalal (2005); the program first
# checks itself against two of their published test pairs. Registered tolerance: Delta E00 <= 2.0.
import math
import random
import statistics

fs = math.fsum
M = ((0.4124564, 0.3575761, 0.1804375), (0.2126729, 0.7151522, 0.0721750), (0.0193339, 0.1191920, 0.9503041))
WHITE = (0.95047, 1.0, 1.08883)


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


def enc(v):
    v = min(1.0, max(0.0, v))
    return 12.92 * v if v <= 0.0031308 else 1.055 * v ** (1 / 2.4) - 0.055


def hex2rgb(h):
    return tuple(int(h[i:i + 2], 16) / 255 for i in (1, 3, 5))


def rgb2hex(rgb):
    return "#" + "".join("{:02X}".format(round(min(1.0, max(0.0, c)) * 255)) for c in rgb)


def lab(h):
    lin = [dec(c) for c in hex2rgb(h)]
    xyz = [fs(m * v for m, v in zip(row, lin)) / w for row, w in zip(M, WHITE)]

    def f(t):
        return t ** (1 / 3) if t > (6 / 29) ** 3 else t / (3 * (6 / 29) ** 2) + 4 / 29
    fx, fy, fz = (f(t) for t in xyz)
    return (116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz))


def de00(p, q):
    (L1, a1, b1), (L2, a2, b2) = p, q
    cb = (math.hypot(a1, b1) + math.hypot(a2, b2)) / 2
    g = 0.5 * (1 - math.sqrt(cb ** 7 / (cb ** 7 + 25 ** 7)))
    a1p, a2p = (1 + g) * a1, (1 + g) * a2
    c1, c2 = math.hypot(a1p, b1), math.hypot(a2p, b2)
    h1 = math.degrees(math.atan2(b1, a1p)) % 360 if c1 else 0.0
    h2 = math.degrees(math.atan2(b2, a2p)) % 360 if c2 else 0.0
    dh = 0.0
    if c1 * c2:
        dh = h2 - h1
        dh = dh - 360 if dh > 180 else dh + 360 if dh < -180 else dh
    dl, dc = L2 - L1, c2 - c1
    dhh = 2 * math.sqrt(c1 * c2) * math.sin(math.radians(dh / 2))
    lm, cm = (L1 + L2) / 2, (c1 + c2) / 2
    if c1 * c2 == 0:
        hm = h1 + h2
    elif abs(h1 - h2) <= 180:
        hm = (h1 + h2) / 2
    else:
        hm = (h1 + h2 + 360) / 2 if h1 + h2 < 360 else (h1 + h2 - 360) / 2
    t = fs([1, -0.17 * math.cos(math.radians(hm - 30)), 0.24 * math.cos(math.radians(2 * hm)),
            0.32 * math.cos(math.radians(3 * hm + 6)), -0.20 * math.cos(math.radians(4 * hm - 63))])
    rot = 30 * math.exp(-((hm - 275) / 25) ** 2)
    rc = 2 * math.sqrt(cm ** 7 / (cm ** 7 + 25 ** 7))
    sl = 1 + 0.015 * (lm - 50) ** 2 / math.sqrt(20 + (lm - 50) ** 2)
    sc, sh = 1 + 0.045 * cm, 1 + 0.015 * cm * t
    rt = -math.sin(math.radians(2 * rot)) * rc
    return math.sqrt(fs([(dl / sl) ** 2, (dc / sc) ** 2, (dhh / sh) ** 2, rt * (dc / sc) * (dhh / sh)]))


def oklch_of(h):
    r, g, b = (dec(c) for c in hex2rgb(h))
    lms = (fs([0.4122214708 * r, 0.5363325363 * g, 0.0514459929 * b]),
           fs([0.2119034982 * r, 0.6806995451 * g, 0.1073969566 * b]),
           fs([0.0883024619 * r, 0.2817188376 * g, 0.6299787005 * b]))
    l_, m_, s_ = (math.copysign(abs(v) ** (1 / 3), v) for v in lms)
    L = fs([0.2104542553 * l_, 0.7936177850 * m_, -0.0040720468 * s_])
    a = fs([1.9779984951 * l_, -2.4285922050 * m_, 0.4505937099 * s_])
    bb = fs([0.0259040371 * l_, 0.7827717662 * m_, -0.8086757660 * s_])
    return L, math.hypot(a, bb), math.degrees(math.atan2(bb, a)) % 360


def hex_of_oklch(L, C, H):
    a, b = C * math.cos(math.radians(H)), C * math.sin(math.radians(H))
    l_, m_, s_ = (fs([L, 0.3963377774 * a, 0.2158037573 * b]), fs([L, -0.1055613458 * a, -0.0638541728 * b]),
                  fs([L, -0.0894841775 * a, -1.2914855480 * b]))
    l, m, s = l_ ** 3, m_ ** 3, s_ ** 3
    lin = (fs([4.0767416621 * l, -3.3077115913 * m, 0.2309699292 * s]),
           fs([-1.2684380046 * l, 2.6097574011 * m, -0.3413193965 * s]),
           fs([-0.0041960863 * l, -0.7034186147 * m, 1.7076147010 * s]))
    return rgb2hex(tuple(enc(v) for v in lin))


# Self-check against Sharma, Wu & Dalal (2005), test pairs 1 and 17.
for p, q, want in (((50, 2.6772, -79.7751), (50, 0, -82.7485), 2.0425),
                   ((50, 2.5, 0), (73, 25, -18), 27.1492)):
    assert abs(de00(p, q) - want) < 5e-5, (p, q, de00(p, q))

ROLES = ("primary", "accent", "text", "muted", "surface", "border")
CANON = {"accent": "#B8913F", "text": "#1B1B20", "muted": "#6B6B76",
         "surface": "#F7F5F0", "border": "#E4E2DC"}
BRAND = {"B": "#8C2F39", "R": "#1F5FA8", "C": "#2E7D5B", "K": "#6B4FA0"}   # primary: one brand per family
FAMILY = {"B": "boutique", "R": "report", "C": "course", "K": "card"}
SITES = [f + "{:02d}".format(i) for f, n in (("B", 8), ("R", 8), ("C", 7), ("K", 7)) for i in range(1, n + 1)]
KEEP = {"in-house": 0.85, "agency": 0.55, "template": 0.30}
SPREAD = {"in-house": 0.6, "agency": 1.0, "template": 1.8}
TOL = 2.0


def canon_of(code, role):
    return BRAND[code[0]] if role == "primary" else CANON[role]


def build(seed=140):
    rng = random.Random(seed)
    out = []
    for code in SITES:
        builder = rng.choices(("in-house", "agency", "template"), weights=(5, 3, 2))[0]
        live = {}
        for role in ROLES:
            canon = canon_of(code, role)
            if rng.random() < KEEP[builder]:
                live[role] = canon
                continue
            L, C, H = oklch_of(canon)
            s = SPREAD[builder]
            L2 = min(0.99, max(0.05, L + rng.gauss(0, 0.035 * s)))
            C2 = max(0.0, C + rng.gauss(0, 0.025 * s))
            live[role] = hex_of_oklch(L2, C2, H + rng.gauss(0, 7 * s))
        decl = rng.randint(140, 460)
        hard = round(decl * (1 - KEEP[builder]) * rng.uniform(0.5, 1.0))
        out.append((code, builder, live, decl, hard))
    return out


if __name__ == "__main__":
    print("Sharma et al. (2005) pairs 1 and 17 reproduced: 2.0425, 27.1492")
    print("shared:  " + "  ".join("{} {}".format(r, v) for r, v in CANON.items()))
    print("primary: " + "  ".join("{} {}".format(FAMILY[k], v) for k, v in BRAND.items()))
    print("site builder    primary  dE00(pri)  worst role  worst dE00  roles>2.0  decl  hard  dev.rate")
    rows = build()
    worst_all, fails, rates, pri = [], 0, [], []
    off_role = {r: 0 for r in ROLES}
    for code, builder, live, decl, hard in rows:
        des = {r: de00(lab(live[r]), lab(canon_of(code, r))) for r in ROLES}
        wr = max(ROLES, key=lambda r: des[r])
        n_over = sum(1 for r in ROLES if des[r] > TOL)
        for r in ROLES:
            off_role[r] += des[r] > TOL
        fails += n_over > 0
        worst_all.append(des[wr])
        pri.append(des["primary"])
        rates.append(hard / decl)
        print("{:4s} {:9s} {}  {:9.2f}  {:10s}  {:10.2f}  {:9d}  {:4d}  {:4d}  {:8.3f}".format(
            code, builder, live["primary"], des["primary"], wr, des[wr], n_over, decl, hard, hard / decl))
    nb = {b: sum(1 for r in rows if r[1] == b) for b in KEEP}
    print("builders: " + ", ".join("{} {}".format(b, n) for b, n in nb.items()))
    print("distinct live primaries: {} for 4 family brands; exact family primary on {} sites".format(
        len({r[2]["primary"] for r in rows}), sum(1 for r in rows if r[2]["primary"] == BRAND[r[0][0]])))
    print("sites with at least one role over dE00 2.0: {} of 30".format(fails))
    print("roles over tolerance, by role: " + ", ".join("{} {}".format(r, n) for r, n in off_role.items()))
    print("primary dE00: median {:.2f}, max {:.2f}; worst-role dE00: median {:.2f}, max {:.2f}".format(
        statistics.median(pri), max(pri), statistics.median(worst_all), max(worst_all)))
    tot_d, tot_h = sum(r[3] for r in rows), sum(r[4] for r in rows)
    print("colour declarations {:,}; hard-coded {:,}; pooled deviation rate {:.3f}; median site rate {:.3f}"
          .format(tot_d, tot_h, tot_h / tot_d, statistics.median(rates)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《跨三十站设计令牌代数、色彩感知均匀空间与品牌权威第一印象毫秒学》第 1 章「方法:多站视觉漂移的三个量、证据分级与《营造法式》材分制」(版本 0.1.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026140,
  author    = {Fan, Yafu},
  title     = {Design-Token Algebra across Thirty Sites, Perceptually Uniform Colour Spaces and the Millisecond Science of Brand-Authority First Impressions},
  year      = {2026},
  publisher = {5D Library},
  edition   = {0.1.0},
  note      = {DOI pending}
}

本书其他章节结论