mirror of
				https://github.com/lutinglt/gitea-github-theme.git
				synced 2025-10-31 17:11:12 +00:00 
			
		
		
		
	支持猛男粉颜色主题
This commit is contained in:
		
							
								
								
									
										77
									
								
								src/core/display.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								src/core/display.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | ||||
| import { type GithubColor } from "./github"; | ||||
|  | ||||
| export type DisplayColor = { | ||||
|   num0: string; | ||||
|   num1: string; | ||||
|   num2: string; | ||||
|   num3: string; | ||||
|   num4: string; | ||||
|   num5: string; | ||||
|   num6: string; | ||||
|   num7: string; | ||||
|   num8: string; | ||||
|   num9: string; | ||||
| }; | ||||
|  | ||||
| export function display2GithubColor( | ||||
|   displayColor: DisplayColor, | ||||
|   baseGithubColor: GithubColor, | ||||
|   soft?: boolean | ||||
| ): GithubColor { | ||||
|   return { | ||||
|     ...baseGithubColor, | ||||
|     fgColor: { | ||||
|       ...baseGithubColor.fgColor, | ||||
|       accent: soft ? displayColor.num7 : displayColor.num6, | ||||
|     }, | ||||
|     bgColor: { | ||||
|       ...baseGithubColor.bgColor, | ||||
|       accent: { | ||||
|         emphasis: displayColor.num5, | ||||
|         muted: soft ? displayColor.num1 : displayColor.num0, | ||||
|       }, | ||||
|     }, | ||||
|     borderColor: { | ||||
|       ...baseGithubColor.borderColor, | ||||
|       accent: { | ||||
|         emphasis: soft ? displayColor.num6 : displayColor.num5, | ||||
|       }, | ||||
|     }, | ||||
|     button: { | ||||
|       ...baseGithubColor.button, | ||||
|       primary: { | ||||
|         ...baseGithubColor.button.primary, | ||||
|         fgColor: { | ||||
|           ...baseGithubColor.button.primary.fgColor, | ||||
|           accent: soft ? displayColor.num6 : displayColor.num5, | ||||
|         }, | ||||
|         bgColor: { | ||||
|           ...baseGithubColor.button.primary.bgColor, | ||||
|           rest: displayColor.num5, | ||||
|           hover: displayColor.num4, | ||||
|         }, | ||||
|       }, | ||||
|       star: { | ||||
|         iconColor: soft ? displayColor.num6 : displayColor.num5, | ||||
|       }, | ||||
|     }, | ||||
|     underlineNav: { | ||||
|       borderColor: { | ||||
|         active: soft ? displayColor.num6 : displayColor.num5, | ||||
|       }, | ||||
|     }, | ||||
|     contribution: { | ||||
|       ...baseGithubColor.contribution, | ||||
|       default: { | ||||
|         ...baseGithubColor.contribution.default, | ||||
|         bgColor: { | ||||
|           num0: baseGithubColor.contribution.default.bgColor.num0, | ||||
|           num1: soft ? displayColor.num2 : displayColor.num1, | ||||
|           num2: soft ? displayColor.num3 : displayColor.num2, | ||||
|           num3: soft ? displayColor.num5 : displayColor.num4, | ||||
|           num4: soft ? displayColor.num7 : displayColor.num6, | ||||
|         }, | ||||
|       }, | ||||
|     }, | ||||
|   }; | ||||
| } | ||||
| @@ -8,6 +8,7 @@ import { type ThemeColor } from "./color"; | ||||
| export type GithubColor = { | ||||
|   isDarkTheme: boolean; | ||||
|   display: { | ||||
|     blue: { fgColor: string }; | ||||
|     brown: { fgColor: string }; | ||||
|     cyan: { fgColor: string }; | ||||
|     indigo: { fgColor: string }; | ||||
| @@ -60,7 +61,7 @@ export type GithubColor = { | ||||
|     translucent: string; | ||||
|   }; | ||||
|   button: { | ||||
|     primary: { fgColor: { rest: string }; bgColor: { hover: string } }; | ||||
|     primary: { fgColor: { accent: string; rest: string }; bgColor: { rest: string; hover: string } }; | ||||
|     danger: { fgColor: { rest: string; hover: string }; bgColor: { hover: string } }; | ||||
|     star: { iconColor: string }; | ||||
|   }; | ||||
| @@ -259,11 +260,14 @@ export function github2ThemeColor(githubColor: GithubColor): ThemeColor { | ||||
|       }, | ||||
|       primary: { | ||||
|         fgColor: { | ||||
|           accent: saturate(0.1, scaleColorLight(githubColor.fgColor.success, githubColor.isDarkTheme ? 10 : -10)), | ||||
|           accent: saturate( | ||||
|             0.1, | ||||
|             scaleColorLight(githubColor.button.primary.fgColor.accent, githubColor.isDarkTheme ? 10 : -10) | ||||
|           ), | ||||
|           rest: githubColor.button.primary.fgColor.rest, | ||||
|         }, | ||||
|         bgColor: { | ||||
|           rest: themeVars.github.bgColor.success.emphasis, | ||||
|           rest: githubColor.button.primary.bgColor.rest, | ||||
|           hover: githubColor.button.primary.bgColor.hover, | ||||
|         }, | ||||
|         borderColor: { | ||||
| @@ -348,7 +352,7 @@ export function github2ThemeColor(githubColor: GithubColor): ThemeColor { | ||||
|       green: githubColor.fgColor.success, | ||||
|       cyan: githubColor.display.cyan.fgColor, | ||||
|       teal: githubColor.display.teal.fgColor, | ||||
|       blue: githubColor.fgColor.accent, | ||||
|       blue: githubColor.display.blue.fgColor, | ||||
|       violet: githubColor.display.indigo.fgColor, | ||||
|       purple: githubColor.fgColor.done, | ||||
|       pink: githubColor.fgColor.sponsors, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 lutinglt
					lutinglt