Switch to using a special attribute for all-white items

This commit is contained in:
Michiel Sikma 2022-07-07 13:29:51 +02:00
parent b29ae0b471
commit 9c0244149b
No known key found for this signature in database
GPG Key ID: 667DBAB05C5E10FF
4 changed files with 119 additions and 59 deletions

View File

@ -3549,8 +3549,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3568,8 +3570,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3587,8 +3591,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3606,8 +3612,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3625,8 +3633,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3644,8 +3654,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3663,8 +3675,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3682,8 +3696,10 @@
"legends-arceus": "2x", "legends-arceus": "2x",
"home": "2x" "home": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
} }
], ],
@ -3711,8 +3727,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3738,8 +3756,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3765,8 +3785,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3792,8 +3814,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3819,8 +3843,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3846,8 +3872,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3873,8 +3901,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3900,8 +3930,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3927,8 +3959,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3954,8 +3988,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -3981,8 +4017,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4008,8 +4046,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4035,8 +4075,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4062,8 +4104,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4089,8 +4133,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4116,8 +4162,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4143,8 +4191,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
}, },
{ {
@ -4170,8 +4220,10 @@
"resolution": { "resolution": {
"gen-8": "2x" "gen-8": "2x"
}, },
"default-background-color": { "attributes": {
"legends-arceus": "#b3b3b3" "legends-arceus": {
"is_all_white": true
}
} }
} }
], ],

View File

@ -7,7 +7,9 @@
:root { :root {
--gh-black: #24292e; --gh-black: #24292e;
--gh-blue: #0366d6; --gh-blue: #0366d6;
--shade-8: #444d56; --shade-10: #3e4650;
--shade-9: #444d56;
--shade-8: #545c68;
--shade-7: #6a737d; --shade-7: #6a737d;
--shade-6: #959da5; --shade-6: #959da5;
--shade-5: #c6cbd1; --shade-5: #c6cbd1;
@ -309,7 +311,7 @@
border-bottom-color: var(--shade-6); border-bottom-color: var(--shade-6);
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 -1px 0 var(--shade-6); box-shadow: inset 0 -1px 0 var(--shade-6);
color: var(--shade-8); color: var(--shade-9);
display: inline-block; display: inline-block;
font-size: 11px; font-size: 11px;
line-height: 10px; line-height: 10px;
@ -502,7 +504,7 @@
border-bottom-color: var(--shade-5); border-bottom-color: var(--shade-5);
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 -1px 0 var(--shade-5); box-shadow: inset 0 -1px 0 var(--shade-5);
color: var(--shade-8); color: var(--shade-9);
display: inline-block; display: inline-block;
font: 11px SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace; font: 11px SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
line-height: 10px; line-height: 10px;

View File

@ -79,6 +79,12 @@
.markdown-body .pokesprite tbody tr.variable-height td { .markdown-body .pokesprite tbody tr.variable-height td {
vertical-align: middle; vertical-align: middle;
} }
.markdown-body .pokesprite tbody td.is-all-white {
background-color: var(--shade-10);
}
.markdown-body .pokesprite tbody tr:hover td.is-all-white {
background-color: var(--shade-7);
}
.markdown-body .pokesprite tbody span[title] { .markdown-body .pokesprite tbody span[title] {
border-bottom: 1px dotted var(--gh-black); border-bottom: 1px dotted var(--gh-black);
} }

View File

@ -453,7 +453,7 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]',
count = get_counter() count = get_counter()
gen_n = get_gen_str(k) gen_n = get_gen_str(k)
res = item['resolution'][k] res = item['resolution'][k]
default_background_color = item.get("default-background-color", {}).get(k, None) attributes = item.get("attributes", {}).get(k, {})
retina_type = \ retina_type = \
'ribbon-gen8' if (res == '2x' and misc_set in ['ribbon', 'mark']) else \ 'ribbon-gen8' if (res == '2x' and misc_set in ['ribbon', 'mark']) else \
'origin-mark' if (res == '2x' and misc_set in ['origin-marks']) else \ 'origin-mark' if (res == '2x' and misc_set in ['origin-marks']) else \
@ -467,7 +467,7 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]',
buffer.append(f'<td{rowspan}>{name_eng_desc}</td>') buffer.append(f'<td{rowspan}>{name_eng_desc}</td>')
buffer.append(f'<td{rowspan}>{name_jpn}</td>') buffer.append(f'<td{rowspan}>{name_jpn}</td>')
buffer.append(f'<td{rowspan}>Gen {origin_gen}</td>') buffer.append(f'<td{rowspan}>Gen {origin_gen}</td>')
buffer.append('<td class="image item"' + (f' style="background-color: {default_background_color}" ' if default_background_color else "") + '>' + get_img_node(get_misc_url(base_url, v), None, f"Sprite for '{name_eng}'", 'm', retina_type) + '</td>') buffer.append('<td class="image item' + (' is-all-white' if attributes.get('is_all_white') else '') + '">' + get_img_node(get_misc_url(base_url, v), None, f"Sprite for '{name_eng}'", 'm', retina_type) + '</td>')
buffer.append(f'<td class="filler{" last-item" if len(vs) > 1 and row_n > 0 else ""}"><code>{v}</code></td>') buffer.append(f'<td class="filler{" last-item" if len(vs) > 1 and row_n > 0 else ""}"><code>{v}</code></td>')
if len(vs) > 1: if len(vs) > 1:
if gen_row_n == 0: if gen_row_n == 0:
@ -531,7 +531,7 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]',
gen_n = get_gen_str(k) gen_n = get_gen_str(k)
colors = item['colors'][k] colors = item['colors'][k]
main_color = colors[0] main_color = colors[0]
default_background_color = item.get("default-background-color", {}).get(k, None) attributes = item.get("attributes", {}).get(k, {})
buffer.append('<tr class="variable-height">') buffer.append('<tr class="variable-height">')
buffer.append(f'<td>{count}</td>') buffer.append(f'<td>{count}</td>')
if row_n == 0: if row_n == 0:
@ -540,7 +540,7 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]',
buffer.append(f'<td{rowspan}>{name_eng.capitalize()}</td>') buffer.append(f'<td{rowspan}>{name_eng.capitalize()}</td>')
buffer.append(f'<td{rowspan} colspan="2">{name_jpn}</td>') buffer.append(f'<td{rowspan} colspan="2">{name_jpn}</td>')
buffer.append('<td class="image item type-icon-' + name_eng + '"' + (f' style="background-color: {default_background_color}" ' if default_background_color else "") + '>' + \ buffer.append('<td class="image item type-icon-' + name_eng + (' is-all-white' if attributes.get('is_all_white') else '') + '">' + \
f'<style>tr:hover .type-icon-{name_eng} {{ background: {main_color} !important; }} tr:hover .type-icon-{name_eng} img {{ filter: brightness(100); }}</style>' + \ f'<style>tr:hover .type-icon-{name_eng} {{ background: {main_color} !important; }} tr:hover .type-icon-{name_eng} img {{ filter: brightness(100); }}</style>' + \
get_img_node(get_misc_url(base_url, v), None, f"Sprite for '{name_eng}'", 'm', 'body-style-gen8') + '</td>') get_img_node(get_misc_url(base_url, v), None, f"Sprite for '{name_eng}'", 'm', 'body-style-gen8') + '</td>')
buffer.append(f'<td class="filler" colspan="1"><code>{v}</code></td>') buffer.append(f'<td class="filler" colspan="1"><code>{v}</code></td>')