mirror of
https://github.com/kennethreitz/rhymepad.org.git
synced 2026-06-11 17:08:33 +00:00
Brightness as a continuous rhyme-strength gradient
The fill (and tail underline) now scale through a per-group strength from the founding key: perfect 1.0, multisyllabic .82, consonant- backed .7, vowel slant .6, consonance .55, weak ending .5. So the page reads rhyme quality as a smooth brightness ramp, not just perfect-vs-slant — the feature, deepened. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1258,8 +1258,15 @@ def analyze(draft: Draft):
|
||||
usage[color] += 1
|
||||
chosen.append(color)
|
||||
sound = re.sub(r"^[a-z0-9]+:", "", g["key"]).replace("|", " ").lower()
|
||||
k = g["key"]
|
||||
strength = (1.0 if k.startswith("p:") # perfect rime
|
||||
else 0.82 if k.startswith("m:") # multisyllabic run
|
||||
else 0.7 if k.startswith("m2:") # consonant-backed
|
||||
else 0.6 if k.startswith("v:") # vowel slant
|
||||
else 0.55 if k.startswith("c:") # consonance
|
||||
else 0.5) # weak ending
|
||||
groups_out.append({"id": gid, "color": color, "slant": g["slant"],
|
||||
"sound": sound})
|
||||
"sound": sound, "strength": round(strength, 2)})
|
||||
|
||||
# stanza rhyme schemes from line-ending groups: the token covering
|
||||
# the most of the line's tail owns the slot — Em rhymes "-cock it",
|
||||
|
||||
+3
-2
@@ -636,7 +636,8 @@ function render(){
|
||||
: (p && (focusGid === null || p.g === focusGid)) ? p
|
||||
: (w || p);
|
||||
let alpha = !t.ph ? (t.end ? 34 : 19) : (t.end ? 24 : 14);
|
||||
if(t.slant) alpha = Math.round(alpha * 0.62); // slant sits back
|
||||
const str = (groupInfo[t.g] && groupInfo[t.g].strength) || 1;
|
||||
alpha = Math.round(alpha * (0.45 + 0.55 * str)); // brightness = rhyme strength
|
||||
if(focusGid !== null && t.g === focusGid){
|
||||
alpha = Math.min(85, Math.round(alpha * 2.8));
|
||||
style += 'color:#1a120c;font-weight:600;'; // dark ink on the lit chip
|
||||
@@ -645,7 +646,7 @@ function render(){
|
||||
// faint underline on the rhyming tail (rs..e) of a word — a
|
||||
// whisper of precision under the full-word fill
|
||||
if(w && w.rs != null && a >= w.rs){
|
||||
const u = w.slant ? 28 : 42;
|
||||
const u = Math.round(42 * ((groupInfo[w.g] && groupInfo[w.g].strength) || 1));
|
||||
shadows.push(`inset 0 -1.5px 0 0 color-mix(in srgb, ${colorOf(w)} ${u}%, transparent)`);
|
||||
}
|
||||
}else if(op){
|
||||
|
||||
Reference in New Issue
Block a user