Skip to content

Commit

Permalink
🐛 fix render style
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Aug 4, 2024
1 parent a72a693 commit b668446
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 47 deletions.
4 changes: 2 additions & 2 deletions src/plugins/github/libs/renderer/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@Author : yanyongyu
@Date : 2022-09-14 16:09:04
@LastEditors : yanyongyu
@LastEditTime : 2024-05-15 23:31:57
@LastEditTime : 2024-08-04 14:05:47
@Description : Jinjia globals for renderer
@GitHub : https://github.com/yanyongyu
"""
Expand All @@ -15,4 +15,4 @@ def scale_linear(value: int, width: int, changed: int) -> int:
See https://github.com/git/git/blob/bcd6bc478adc4951d57ec597c44b12ee74bc88fb/diff.c#L2500-L2511.
"""
return 1 + int(value * (width - 1) / changed) if value else value
return value and (1 + int(value * (width - 1) / changed))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author : yanyongyu
* @Date : 2022-09-17 09:29:08
* @LastEditors : yanyongyu
* @LastEditTime : 2024-05-16 16:02:29
* @LastEditTime : 2024-08-04 13:10:04
* @Description : None
* @GitHub : https://github.com/yanyongyu
-->
Expand Down Expand Up @@ -69,12 +69,12 @@ is_first=false, is_review=false, highlight=false
">
<div class="d-none d-sm-flex">
{% if author_association != "NONE" %}
<span class="Label Label--primary ml-1">
<span class="Label Label--secondary ml-1">
{{ author_association|title|escape }}
</span>
{% endif %}
{% if is_author %}
<span class="Label Label--primary ml-1">Author</span>
<span class="Label Label--secondary ml-1">Author</span>
{% endif %}
</div>
<h3 class="flex-auto text-normal f5">
Expand Down
73 changes: 38 additions & 35 deletions src/plugins/github/libs/renderer/templates/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author : yanyongyu
* @Date : 2022-09-16 12:36:00
* @LastEditors : yanyongyu
* @LastEditTime : 2024-05-31 14:39:34
* @LastEditTime : 2024-08-04 14:10:37
* @Description : None
* @GitHub : https://github.com/yanyongyu
*/
Expand All @@ -19,9 +19,9 @@
padding: 0.125em 0.5em 0.125em 0;
font-size: 12px;
font-weight: 400;
color: var(--color-fg-default);
color: var(--fgColor-default);
text-align: left;
fill: var(--color-fg-default);
fill: var(--fgColor-default);
}

.ContributionCalendar-day {
Expand Down Expand Up @@ -96,15 +96,17 @@
transform: translateY(-50%);
}

/* issue title inline code */
.markdown-title code {
padding: 2px 4px;
font-size: 0.9em;
line-height: 1;
vertical-align: middle;
background-color: var(--color-neutral-muted);
background-color: var(--bgColor-neutral-muted);
border-radius: 6px;
}

/* github emoji */
g-emoji {
display: inline-block;
min-width: 1ch;
Expand All @@ -116,8 +118,11 @@ g-emoji {
vertical-align: -0.075em;
}

/* timeline comment */
.timeline-comment.timeline-comment-highlight {
box-shadow: 0 0 0 1px var(--color-accent-emphasis);
border-color: var(--borderColor-accent-emphasis);
outline: none !important;
box-shadow: 0 0 0 1px var(--fgColor-accent) !important;
}
.timeline-comment::before,
.timeline-comment::after {
Expand All @@ -133,18 +138,15 @@ g-emoji {
--webkit-clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.timeline-comment::before {
background-color: var(--color-border-default);
background-color: var(--borderColor-default);
}
.timeline-comment.timeline-comment-highlight::before {
background-color: var(--color-accent-emphasis);
background-color: var(--bgColor-accent-emphasis);
}
.timeline-comment::after {
margin-left: 2px;
background-color: var(--color-canvas-default);
background-image: linear-gradient(
var(--color-canvas-subtle),
var(--color-canvas-subtle)
);
background-color: var(--bgColor-default);
background-image: linear-gradient(var(--bgColor-muted), var(--bgColor-muted));
}
.timeline-comment.timeline-comment-nw::before {
top: -12px;
Expand All @@ -159,6 +161,7 @@ g-emoji {
transform: rotate(90deg);
}

/* timeline comment reaction */
.comment-reaction-button {
height: 26px;
line-height: 26px;
Expand All @@ -170,6 +173,7 @@ g-emoji {
margin-left: 2px;
}

/* issue label */
.hx_IssueLabel {
--perceived-lightness: calc(
(
Expand Down Expand Up @@ -239,30 +243,28 @@ g-emoji {
.diffstat {
font-size: 12px;
font-weight: 600;
color: var(--color-fg-muted);
color: var(--fgColor-muted);
white-space: nowrap;
cursor: default;
}
.diffstat-block-deleted,
.diffstat-block-added,
.diffstat-block-neutral {
display: inline-block;
width: 8px;
height: 8px;
width: 0.5rem;
height: 0.5rem;
margin-left: 1px;
outline-offset: -1px;
}
.diffstat-block-deleted {
background-color: var(--color-danger-emphasis);
outline: 1px solid var(--color-border-subtle);
background-color: var(--bgColor-danger-emphasis);
}
.diffstat-block-added {
background-color: var(--color-success-emphasis);
outline: 1px solid var(--color-border-subtle);
background-color: var(--bgColor-success-emphasis);
}
.diffstat-block-neutral {
background-color: var(--color-neutral-muted);
outline: 1px solid var(--color-border-subtle);
background-color: var(--bgColor-neutral-muted);
outline: 1px solid var(--borderColor-muted);
outline-offset: -1px;
}

.blob-num {
Expand All @@ -275,7 +277,7 @@ g-emoji {
Liberation Mono, monospace;
font-size: 12px;
line-height: 20px;
color: var(--color-fg-subtle);
color: var(--fgColor-muted);
text-align: right;
white-space: nowrap;
vertical-align: top;
Expand All @@ -284,12 +286,12 @@ g-emoji {
user-select: none;
}
.blob-num-addition {
color: var(--color-fg-default);
background-color: var(--color-success-subtle);
color: var(--fgColor-default);
background-color: var(--bgColor-success-muted);
}
.blob-num-deletion {
color: var(--color-fg-default);
background-color: var(--color-danger-subtle);
color: var(--fgColor-default);
background-color: var(--bgColor-danger-muted);
}
.blob-code {
position: relative;
Expand All @@ -304,7 +306,7 @@ g-emoji {
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,
Liberation Mono, monospace;
font-size: 12px;
color: var(--color-fg-default);
color: var(--fgColor-default);
word-wrap: anywhere;
white-space: pre-wrap;
}
Expand All @@ -318,30 +320,31 @@ g-emoji {
padding-top: 4px;
padding-bottom: 4px;
padding-left: 22px;
color: var(--color-fg-subtle);
background-color: var(--color-accent-subtle);
color: var(--fgColor-muted);
background-color: var(--bgColor-accent-muted);
border-width: 1px 0;
}
.blob-code-addition {
background-color: var(--color-success-subtle);
background-color: var(--bgColor-success-muted);
}
.blob-code-deletion {
background-color: var(--color-danger-subtle);
background-color: var(--bgColor-danger-muted);
}

/* timeline hidden item */
.pagination-loader-container {
background-color: var(--color-canvas-default);
background-color: var(--bgColor-default);
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M0 11L8 5L16 11' stroke='%23e1e4e8' stroke-linecap='square' stroke-width='1.5'/%3E%3C/svg%3E");
background-repeat: repeat-x;
background-position: center;
background-size: 16px;
background-size: 1rem;
}
[data-color-mode="light"][data-light-theme*="dark"]
.pagination-loader-container,
[data-color-mode="dark"][data-dark-theme*="dark"] .pagination-loader-container {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M0 11L8 5L16 11' stroke='%2330363d' stroke-linecap='square' stroke-width='1.5'/%3E%3C/svg%3E");
}
.discussion-item-header {
color: var(--color-fg-muted);
color: var(--fgColor-muted);
word-wrap: break-word;
}
9 changes: 2 additions & 7 deletions src/plugins/github/libs/renderer/templates/main.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author : yanyongyu
* @Date : 2022-09-15 03:56:36
* @LastEditors : yanyongyu
* @LastEditTime : 2024-05-16 15:56:57
* @LastEditTime : 2024-08-04 12:38:49
* @Description : None
* @GitHub : https://github.com/yanyongyu
-->
Expand Down Expand Up @@ -41,12 +41,7 @@
href="https://avatars.githubusercontent.com"
/>
<link
href="https://unpkg.com/@primer/css@^21.0.1/dist/primitives.css"
rel="stylesheet"
type="text/css"
/>
<link
href="https://unpkg.com/@primer/css@^21.0.1/dist/primer.css"
href="https://unpkg.com/@primer/css@^21.3.5/dist/primer.css"
rel="stylesheet"
type="text/css"
/>
Expand Down

0 comments on commit b668446

Please sign in to comment.