基于哪吒监控面板默认主题的简单美化

哪吒监控是 VPS 圈最流行的小鸡监控面板,它开源免费且美观好用,具备 VPS 状态监控、ping 延迟测试和 tg 离线通知等功能。

哪吒监控 github 项目地址:
https://github.com/naiba/nezha

官方 wiki 及详细安装教程:
https://nezha.wiki/guide/dashboard.html

当我们安装好默认的面板后,有时候会想要修改显示背景、Logo、页脚和添加网站统计等功能,但又不想使用第三方的美化主题,想要更简单轻量一点。那么以下就是我所使用的基于默认 Default 主题,仅仅修改自定义代码进行的简单美化。

自定义代码(哪吒面板后台——设置——自定义代码):

<style>
/* 全局字体和背景设置 */
body, .ui.content, .status.cards .ui.content.popup {
    font-family: "Microsoft JhengHei UI", Arial, Helvetica, sans-serif !important;
}

/* 背景图片 */
body::before {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: url(https://image.jpg);
    background-position: top;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: -1;
    pointer-events: none;
}

/* 屏幕适配 */
@media only screen and (min-width: 1200px) {
    .ui.container {
        width: 80% !important;
    }
}

@media only screen and (max-width: 767px) {
    .ui.card > .content > .header:not(.ui),
    .ui.cards > .card > .content > .header:not(.ui) {
        margin-top: 0.4em !important;
    }
}

/* 导航栏设置 */
.ui.large.menu {
    border: 0 !important;
    border-radius: 0 !important;
    background-color: rgba(255, 255, 255, 0.55) !important;
}

.ui.menu .active.item {
    background-color: transparent !important;
}

.ui.dropdown .menu {
    border: 0 !important;
    border-radius: 0 !important;
    background-color: rgba(255, 255, 255, 0.8) !important;
}

/* 按钮设置 */
.nezha-primary-btn {
    background-color: transparent !important;
    color: #000 !important;
}

/* 卡片设置 */
#app .ui.fluid.accordion,
.ui.four.cards > .card {
    border-radius: 0.4rem !important;
    background-color: rgba(251, 251, 251, 0.15) !important;
}

.ui.four.cards > .card {
    border-radius: 0.6rem !important;
    background-color: rgba(250, 250, 250, 0.64) !important;
}

/* 状态卡片 */
.status.cards .flag {
    margin-right: 0.5rem !important;
}

.status.cards .header > .info.icon {
    margin-right: 0 !important;
}

.status.cards .outline.icon {
    margin-right: 1px !important;
}

i.arrow.alternate.circle.down.outline.icon {
    color: #2175ba !important;
}

i.arrow.alternate.circle.up.outline.icon {
    color: red !important;
}

.nezha-secondary-font {
    color: #2175ba !important;
}

/* 弹出卡片 */
.ui.right.center.popup,
.ui.left.center.popup {
    margin: -3px 0 0 0.914286em !important;
    transform-origin: left 50% !important;
}

.ui.bottom.left.popup {
    margin-left: 1px !important;
    margin-top: 3px !important;
}

.ui.top.left.popup {
    margin-left: 0 !important;
    margin-bottom: 10px !important;
}

.ui.top.right.popup {
    margin-right: 0 !important;
    margin-bottom: 8px !important;
}

.ui.left.center.popup {
    margin: -3px 0.91428571em 0 0 !important;
    transform-origin: right 50% !important;
}

.ui.right.center.popup:before,
.ui.left.center.popup:before,
.ui.top.popup:before,
.ui.bottom.left.popup:before,
.ui.bottom.right.popup:before,
.ui.top.left.popup:before,
.ui.top.right.popup:before {
    border-radius: 0 !important;
    border: 1px solid transparent !important;
    background: rgba(250, 250, 250, 0.92) !important;
    box-shadow: 0px 0px 0 0 #fafafaeb !important;
    tap-highlight-color: rgba(0, 0, 0, 0) !important;
}

.status.cards .ui.content.popup {
    min-width: 20rem !important;
    line-height: 2rem !important;
    border-radius: 5px !important;
    border: 1px solid transparent !important;
    background-color: rgba(250, 250, 250, 0.92) !important;
}

/* 服务页 */
.ui.table {
    background: rgba(225, 225, 225, 0.6) !important;
}

.ui.table thead th {
    background: transparent !important;
}

/* 服务页进度条 */
.service-status .good {
    background-color: #2175ba !important;
}

.service-status .danger {
    background-color: red !important;
}

.service-status .warning {
    background-color: orange !important;
}

/* 版权信息 */
.ui.inverted.segment, .ui.primary.inverted.segment {
    color: #000 !important;
    font-weight: bold !important;
    background-color: rgba(250, 250, 250, 0.64) !important;
}
</style>

<!-- Logo & Footer -->
<script>
window.onload = function() {
    var avatar = document.querySelector(".item img");
    var footer = document.querySelector("div.is-size-7");
    footer.innerHTML = "页脚版权说明";
    footer.style.visibility = "visible";
    avatar.src = "https://image.png";
    avatar.style.visibility = "visible";
}
</script>

<!-- Favicon -->
<script>
    var faviconurl = "https://image.png";
    var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
    link.type = 'image/png';
    link.rel = 'shortcut icon';
    link.href = faviconurl;
    document.getElementsByTagName('head')[0].appendChild(link);
</script>

<!--统计代码-->
<script async src="https://tongji.com/tongji.js"></script>

以上自定义代码只是示例,不可用直接拿来使用,代码里的链接及网站统计都要替换成你自己的。背景图、Logo 和 favicon 我们都可以使用第三方图床来解决,这里推荐使用兽兽(Xtom 老板)的免费图床 sm.ms,免费且快速。

如果你想直接使用自动抓取的 bing 搜索每日图片,这里也有免费稳定的 api 提供免费试用。

必应图片 API github 项目地址:
https://github.com/flow2000/bing-wallpaper-api

获取今日壁纸:
https://api.bimg.cc/today?w=1920&h=1080&mkt=zh-CN

获取随机壁纸:
https://api.bimg.cc/random?w=1920&h=1080&mkt=zh-CN

感谢所有免费图床的提供者以及开源作者的辛勤付出。

最终的效果可参考我的探针:
https://misaka.se

添加新评论