关于「三十站的治理:发布、漂移检测、按品牌换主题、审计与回滚」,《跨站设计令牌与感知色彩》给出的定量结论是什么?

结论:三十个站点的治理,靠的是四件可以计算的事。p60 的站点表告诉你谁落在哪个版本、偏离了多少,并把撤回版本上的站点挂出来;p61 说明分批上线能把一次全面缺陷的暴露压到不到一半,而第一批要覆盖每个家族才能拦住只在某个家族出现的缺陷。p62 把线上的越界颜色分进不同的队列,并找出漂到别的角色上去的错位色;p63 说明第一印象监测要用累积和,否则三十个站点半年会凭空报出十几次警。p64 的四道护栏防止换色时与别的家族、与状态色撞色;p65 的两道闸让大版本既不放过新断链也不被旧问题卡住;p66 说明回滚并不总是安全的;p67 让每一版都能被追查。第七章把这些检查按四类站点落成手册,并把断链、循环与色差越界编进样式库的拒绝码。

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

English version

对照数据表

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

largest dE00 a one-step change in one 8-bit channel causes on the 9 canonical colours: 1.1445
180 site-role values: EXACT 127, ROUND 0, NEAR 6, DRIFT 44, FOREIGN 3
DRIFTtickets 44: primary 10, accent 6, text 8, muted 8, surface 4, border 8
FOREIGN tickets3: primary 1, accent 1, text 1
SWAP R03 border is 3.38 from its own token but 2.12 from surface
SWAP R04 surface is 4.14 from its own token but 2.79 from border
SWAP R07 border is 4.10 from its own token but 2.80 from surface
SWAP K05 surface is 5.75 from its own token but 3.20 from border
FOREIGN list: B08 text 14.88; B08 primary 12.27; K06 accent 11.54
live table (site, then primary, accent, text, muted, surface, border)
B01 agency#8C2F39 #B8913F #1B1B20 #6B6B76 #FEFBF5 #E4E2DC
B02 in-house#8C2F39 #B8913F #1B1B20 #605E74 #F7F5F0 #E4E2DC
B03 in-house#7D323F #B88933 #1B1B20 #6B6B76 #F7F5F0 #E4E2DC
B04 agency#8C2F39 #B8913F #1B1B20 #63616E #F7F5F0 #E4E2DC
B05 agency#783348 #B8913F #1B1B20 #6B6B76 #F7F5F0 #DAD4B5
B06 in-house#8C2F39 #B8913F #24242C #6B6B76 #F7F5F0 #E4E2DC
B07 in-house#863036 #B8913F #1B1B20 #6B6B76 #F7F5F0 #E4E2DC
B08 template#900A05 #D5AE63 #262C51 #757575 #F7F5F0 #E4E2DC
R01 agency#1F5FA8 #BD9939 #1B1B20 #6B6B76 #F1EEE8 #E4DECE
R02 agency#114F91 #B8913F #1B1B20 #6B6B76 #F7F5F0 #E4E2DC
R03 in-house#1F5FA8 #B8913F #1B1B20 #6B6B76 #F7F5F0 #F4F0E7
R04 agency#4E67B6 #B8913F #202020 #6B6B76 #EDE6DC #E4E2DC
R05 in-house#1F5FA8 #B8913F #1B1B20 #6B6B76 #F7F5F0 #E4E2DC
R06 template#4061B0 #B8913F #1C1D2C #6B6B76 #F7F5F0 #D8D6D2
R07 in-house#2561B6 #B8913F #1B1B20 #6B6B76 #F7F5F0 #EFEFEF
R08 in-house#1F5FA8 #C59943 #1B1B20 #6B6B76 #F7F5F0 #E4E2DC
C01 agency#55836F #B7A15D #1B182A #6B6B76 #F7F5F0 #E4E2DC
C02 in-house#2E7D5B #B8913F #1B1B20 #6B6B6B #F7F5F0 #E4E2DC
查看完整验算程序
# Chapter 6. p62: Drift triage on the live colours of the book-wide sample: who fixes what, and how fast.
# Rebuilds the chapter 1 sample exactly (p10's drift model and seed 140, code copied unchanged) and sorts
# all 180 site-role values: EXACT; ROUND (no channel more than one 8-bit step off); NEAR (dE00 within the
# registered 2.0); DRIFT (2.0 to 10.0); FOREIGN (10.0 and over). A drifted value whose nearest canonical
# value belongs to another role is flagged SWAP. The 10.0 line is this chapter's governance choice.
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


def classify(live, canon):
    d = de00(lab(live), lab(canon))
    step = max(abs(round(x * 255) - round(y * 255)) for x, y in zip(hex2rgb(live), hex2rgb(canon)))
    cls = ("EXACT" if step == 0 else "ROUND" if step == 1 else "NEAR" if d <= TOL
           else "DRIFT" if d < 10.0 else "FOREIGN")
    return cls, d


if __name__ == "__main__":
    pal = sorted(set(CANON.values()) | set(BRAND.values()))
    worst = 0.0
    for h in pal:
        base = [round(c * 255) for c in hex2rgb(h)]
        for i in range(3):
            for s in (-1, 1):
                nb = list(base)
                nb[i] = min(255, max(0, nb[i] + s))
                worst = max(worst, de00(lab(h), lab("#%02X%02X%02X" % tuple(nb))))
    print("largest dE00 a one-step change in one 8-bit channel causes on the 9 canonical colours: {:.4f}"
          .format(worst))
    rows = build()
    tally = {k: 0 for k in ("EXACT", "ROUND", "NEAR", "DRIFT", "FOREIGN")}
    swaps, tickets = [], {"DRIFT": [], "FOREIGN": []}
    for code, builder, live, decl, hard in rows:
        canon = {r: canon_of(code, r) for r in ROLES}
        for r in ROLES:
            cls, d = classify(live[r], canon[r])
            tally[cls] += 1
            if cls in tickets:
                tickets[cls].append((code, r, d))
            if cls in ("DRIFT", "FOREIGN"):
                near = min(ROLES, key=lambda q: de00(lab(live[r]), lab(canon[q])))
                if near != r:
                    swaps.append((code, r, near, de00(lab(live[r]), lab(canon[near])), d))
    print("180 site-role values: " + ", ".join("{} {}".format(k, v) for k, v in tally.items()))
    for k in ("DRIFT", "FOREIGN"):
        by = {}
        for code, r, d in tickets[k]:
            by[r] = by.get(r, 0) + 1
        print("{:7} tickets {:2}: {}".format(k, len(tickets[k]), ", ".join(
            "{} {}".format(r, by[r]) for r in ROLES if r in by)))
    for code, r, near, dn, d in swaps:
        print("SWAP {} {} is {:.2f} from its own token but {:.2f} from {}".format(code, r, d, dn, near))
    fx = sorted(tickets["FOREIGN"], key=lambda t: -t[2])
    print("FOREIGN list: " + "; ".join("{} {} {:.2f}".format(c, r, d) for c, r, d in fx))
    print("live table (site, then " + ", ".join(ROLES) + ")")
    for code, builder, live, decl, hard in rows:
        print("  {} {:9} {}".format(code, builder, " ".join(live[r] for r in ROLES)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《跨三十站设计令牌代数、色彩感知均匀空间与品牌权威第一印象毫秒学》第 6 章「三十站的治理:发布、漂移检测、按品牌换主题、审计与回滚」(版本 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}
}

本书其他章节结论