Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f79effd

Browse files
committed
change code complexity highlight color on light theme
1 parent 8f71ae3 commit f79effd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎src/popup/popup.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async function getCodeFromActiveTab(): Promise<string | null> {
9898
}
9999
},
100100
);
101-
});
101+
});
102102
});
103103
}
104104

@@ -109,9 +109,14 @@ function timeout(ms: number): Promise<never> {
109109
}
110110

111111
function formatResponseText(text: string): string {
112+
// Get the current theme from the document attribute
113+
const isDarkTheme = document.documentElement.getAttribute('data-theme') === 'dark';
114+
const complexityColor = isDarkTheme ? '#1abc9c' : '#0057b8'; // teal vs rich blue
115+
112116
return text
113-
.replace(/time/gi, '<span style="color: lightgreen;">time complexity</span>')
114-
.replace(/space/gi, '<span style="color: lightgreen;">space complexity</span>');
117+
.replace(/time/gi, `<span style="color: ${complexityColor}; font-weight: bold;">time complexity</span>`)
118+
.replace(/space/gi, `<span style="color: ${complexityColor}; font-weight: bold;">space complexity</span>`)
119+
.replace(/O\([^)]+\)/g, `<span style="color: ${complexityColor}; font-weight: bold;">$&</span>`);
115120
}
116121

117122
function stripMarkdownCodeBlock(text: string): string {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /