Skip to content

简悦主题 | Simpread Theme by ped-Yc

Screenshot of 简悦主题 | Simpread Theme

Details

Authorped-Yc

LicenseNo License

Category*

Created

Updated

Size6.7 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

简悦阅读模式样式美化。只会对<sr-read>标签生效

Simpread read mode style beautify.Only take effect on <sr-read>

Notes

Userstyle doesn't have notes.

Source code

/* ==UserStyle==
@name       简悦
@version    20250218.05.33
@namespace  ?
==/UserStyle== */

:root {
    --sr-primary-color: #4d715b;
    --sr-accent-color: #0d400d;
    --sr-background-color: rgba(255, 255, 255, 0.95);
    --sr-hyperlink-color: #5BA4B5;
    --sr-box-shadow: 0 8px 16px rgba(0, 32, 0, 0.12);
    --sr-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基础重置 */
sr-read toc-bg,
sr-read toc {
    all: initial;
}

/* 容器优化 */
.simpread-read-root {
    background: linear-gradient(rgba(77, 113, 91, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 113, 91, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    background-attachment: fixed;
    isolation: isolate;
}

/* 主内容区 */
sr-read {
    width: min(800px, 90%) !important;
    min-width: 800px;
    margin: 40px auto;
    padding: 2rem 3rem;
    background: var(--sr-background-color);
    border-radius: 12px;
    box-shadow: var(--sr-box-shadow);
    transition: var(--sr-transition);
    z-index: 1;
    transform-origin: center top;
    animation: sr-entry 0.6s ease-out;
}

sr-read:hover {
    box-shadow: 0 12px 24px rgba(0, 32, 0, 0.18);
}

/* 排版系统 */
sr-read * {
    font-family: "LXGW WenKai GB Screen", system-ui;
    line-height: 1.7;
    color: #334139;
}

sr-read a {
    color: var(--sr-hyperlink-color);
    text-decoration: none;
    background: linear-gradient(currentColor 0 100%) 0 100% / 0 1px no-repeat;
    transition: background-size 0.3s ease;
}

/* 段落样式 */
sr-read p {
    margin: 1.5em 0;
    padding-left: 1rem;
    border-left: 3px solid rgba(77, 113, 91, 0.15);
}

sr-read a:hover {
    background-size: 100% 1px;
}

/* 标题系统 */
sr-read sr-rd-title,
sr-read h1,
sr-read h2,
sr-read h3,
sr-read h4,
sr-read h5,
sr-read h6 {
    font-family: "Aa奶糖油画体", cursive;
    color: var(--sr-primary-color);
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed var(--sr-primary-color);
    animation: fade-in 0.9s ease-out;
}

sr-read sr-rd-title {
    font-size: 2.4rem;
    text-align: center;
    margin: 2rem 0 2.5rem;
}

/* 头图优化 */
sr-read .sr-cover {
    overflow: hidden;
    border-radius: 8px;
    transition: var(--sr-transition);

    > img {
        width: 100%;
        height: 360px;
        object-fit: cover;
        transition: transform 0.4s ease;

        &:hover {
            transform: scale(1.02);
        }
    }
}

/* 代码块 */
sr-read pre,
sr-read code {
    font-family: "LXGW WenKai Mono GB Screen", monospace;
    background: rgba(77, 113, 91, 0.08);
    border-radius: 6px;
    padding: 1rem;
    font-size: 1.4rem;
    line-height: 1.6;
    overflow-x: auto;
}

/* 目录系统 */
sr-read toc-bg {
    /* 定位系统 */
    position: fixed !important;
    left: 10px;
    top: clamp(20px, 50vh, calc(100vh - 200px)) !important;
    transform: translateY(-50%) !important;
    z-index: 1000;
    max-width: 500px!important;
    max-height: 100vh;
    overflow-y: hidden;
    padding: 10px;
}

/* 默认状态下隐藏内部内容 */
sr-read toc-bg toc,
sr-read toc-bg .toc-title,
sr-read toc-bg outline {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* 内部目录样式保持原有定义 */
sr-read toc-bg toc {
    display: flex;
    flex-direction: column;
    box-shadow: var(--sr-box-shadow);
    border-radius: 12px;
    max-width: 500px;
    padding: 10px;
    overflow-y: auto;
    transition: max-width 0.3s ease, padding 0.3s ease, background 0.3s ease;

    /* 鼠标移入时展开目录 */
    &:hover {
        cursor: pointer;
        max-height: 80vh;
        max-width: 500px;
        /* 展开高度足够显示所有内容 */
        padding: 1rem 2rem 1rem 0;
        /* 恢复内边距 */
        background: var(--sr-background-color) !important;
        /* 恢复背景色 */
    }

    & outline a::before {
        content: "";
        position: absolute;
        left: -8px;
        top: 50%;
        width: 6px;
        height: 2px;
        background: rgba(77, 113, 91, 0.3);
        transition: width 0.3s ease;
    }

    & outline:hover a {
        background: rgba(77, 113, 91, 0.08);
        padding-left: 1.6rem;
    }

    & outline:hover a::before {
        width: 10px;
        background: var(--sr-accent-color);
    }

    & .toc-title {
        font-family: "Aa奶糖油画体", cursive;
        color: var(--sr-accent-color);
        font-size: 1.8rem;
        margin-bottom: 1rem;
        border-bottom: 2px solid rgba(77, 113, 91, 0.15);
    }

    & outline {
        /*         padding: 6px 12px; */
        transition: var(--sr-transition);
    }

    & outline a {
        color: var(--sr-primary-color);
        font-size: 1.4rem;
        padding: 0.5rem 1rem;
        border-radius: 6px;
        display: block;
        position: relative;
        transition: var(--sr-transition);
    }

    & .toc-outline-active + a {
        font-weight: 600;
        color: var(--sr-accent-color);
        background: var(--sr-hyperlink-color);
    }
}

/* 鼠标移入时内部内容渐显 */
sr-read toc-bg:hover toc,
sr-read toc-bg:hover .toc-title,
sr-read toc-bg:hover outline {
    opacity: 1;
}


/* 调整不同目录级别的缩进 */
sr-read toc-bg.toc-level-h2 {
    margin-left: 1rem;
}
sr-read toc-bg.toc-level-h3 {
    margin-left: 2rem;
}
sr-read toc-bg.toc-level-h4 {
    margin-left: 3rem;
}

/* 响应式设计 */
@media screen and (max-width: 1024px) {
    sr-read toc-bg {
        display: none!important;
    }
}

/* 动画系统 */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sr-entry {
    from {
        opacity: 0;
        transform: translateY(20px) rotateX(2deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

@keyframes title-entry {
    from {
        opacity: 0;
        letter-spacing: 0.15em;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        letter-spacing: 0.05em;
        transform: translateX(0);
    }
}

@-moz-document url-prefix("https://segmentfault.com/") {
button[data-toggle="tooltip"] {
    display: none;
}
}

@-moz-document url-prefix("https://dev.to/") {
sr-rd-content {
    pre {
        color: #000!important;
    }
}
}

Reviews

No reviews yet.