add custom icon

This commit is contained in:
bymyself
2025-04-25 16:25:11 -07:00
parent 1a54781dbf
commit c4b526dce5
8 changed files with 59 additions and 3 deletions
+4 -1
View File
@@ -1,4 +1,3 @@
// Copyright (C) 2025 AIDC-AI
// Licensed under the MIT License.
@@ -7,4 +6,8 @@ import { api } from "../../scripts/api.js";
setTimeout(() => {
import(api.api_base + "/copilot_web/input.js");
const fontsLink = document.createElement("link");
fontsLink.rel = "stylesheet";
fontsLink.href = api.api_base + "/copilot_web/fonts.css";
document.head.appendChild(fontsLink);
}, 500);
+32
View File
@@ -0,0 +1,32 @@
/* Font declarations */
@font-face {
font-family: "cc-font";
src: url("./fonts/cc-icon.eot?jbqswq");
src:
url("./fonts/cc-icon.eot?jbqswq#iefix") format("embedded-opentype"),
url("./fonts/cc-icon.ttf?jbqswq") format("truetype"),
url("./fonts/cc-icon.woff?jbqswq") format("woff"),
url("./fonts/cc-icon.svg?jbqswq#icomoon") format("svg");
font-weight: normal;
font-style: normal;
font-display: block;
}
/* Icon classes */
[class^="cc-icon-"],
[class*=" cc-icon-"] {
font-family: "cc-font" !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.cc-icon-logo:before {
content: "\e900";
color: #5a6e87;
}
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="cc-icon-logo" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe900;" glyph-name="cc-icon-logo" horiz-adv-x="1673"
d="M906.481 167.044c15.788-13.747 25.93-33.267 39.169-49.417 22.2-27.083 46.786-51.878 73.784-74.187 113.365-93.678 269.428-126.606 411.808-92.56 73.125 17.487 142.693 54.305 197.668 105.778 13.006 12.178 53.992 39.534 42.374 60.969-18.854 34.792-63.823 63.924-91.795 91.786-8.827 8.794-21.682 27.276-35.263 28.050-16.084 0.915-36.091-27.245-47.097-36.886-28.196-24.706-60.948-41.68-96.478-53.102-173.291-55.714-342.902 64.244-379.574 236.062-38.882 182.156 108.181 397.985 306.625 378.080 49.205-4.935 93.582-18.39 136.485-43.28 17.336-10.055 45.953-43.303 65.859-42.95 13.952 0.247 26.502 19.294 35.34 28.186l72.953 72.918c13.18 13.272 28.499 24.311 13.481 42.386-30.66 36.9-75.083 64.456-117.038 86.609-236.218 124.71-524.747 26.944-647.564-206.622-70.937-134.904-51.37-300.081-136.974-428.28-60.333-90.353-161.902-148.55-272.043-140.826-39.684 2.781-79.512 12.152-115.306 29.693-209.829 102.813-227.887 405.861-47.064 545.398 76.222 58.818 181.297 72.85 270.617 37.759 23.619-9.279 45.249-21.642 65.889-36.366 8.834-6.302 21.249-19.623 32.945-18.967 12.851 0.725 24.617 17.383 32.945 25.709 23.953 23.946 46.697 48.991 70.596 72.949 8.69 8.709 29.118 23.2 24.16 37.649-7.445 21.708-41.574 40.962-59.458 53.669-66.169 47.014-147.286 75.662-228.259 80.526-258.778 15.547-493.713-175.651-521.873-437.754-23.113-215.126 72.448-430.276 270.082-532.225 168.048-86.684 375.745-61.882 522.407 54.316 39.341 31.17 92.301 76.815 110.6 124.931z" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -13,6 +13,7 @@ import React, { Suspense } from "react";
import ReactDOM from "react-dom/client";
import { waitForApp } from "./utils/comfyapp.ts";
import "./scoped-tailwind.css";
import "./fonts.css";
const App = React.lazy(() =>
import("./App.tsx").then(({ default: App }) => ({
@@ -37,7 +38,7 @@ waitForDocumentBody()
.then(() => {
app.extensionManager.registerSidebarTab({
id: "comfyui-copilot",
icon: "mdi mdi-robot-excited-outline",
icon: "cc-icon-logo",
title: "ComfyUI Copilot",
tooltip: "ComfyUI Copilot",
type: "custom",
+7 -1
View File
@@ -81,6 +81,7 @@ export default defineConfig(({ mode }) => ({
external: ["/scripts/app.js", "/scripts/api.js"],
input: {
input: "/src/main.tsx",
fonts: "/src/fonts.css"
},
output: {
// Provide global variables to use in the UMD build for externalized deps
@@ -92,7 +93,12 @@ export default defineConfig(({ mode }) => ({
// assetFileNames: "[name]-[hash][extname]",
entryFileNames: "copilot_web/[name].js",
chunkFileNames: `copilot_web/[name]-[hash].js`,
assetFileNames: `copilot_web/assets/[name]-[hash].[ext]`,
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'fonts.css') {
return 'copilot_web/[name].css';
}
return `copilot_web/assets/[name]-[hash].[ext]`;
},
manualChunks: {
// 只包含实际使用的 React 相关依赖
'vendor-react': ['react', 'react-dom'],