MCPcopy Create free account
hub / github.com/duckdb/duckdb / ToggleMode

Method ToggleMode

tools/shell/shell_highlight.cpp:252–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void ShellHighlight::ToggleMode(HighlightMode mode) {
253 bool user_configured = false;
254 if (mode == HighlightMode::MIXED_MODE) {
255 SetColor(HighlightElementType::KEYWORD, PrintColor::GREEN, PrintIntensity::STANDARD, user_configured);
256 SetColor(HighlightElementType::STRING_CONSTANT, PrintColor::YELLOW, PrintIntensity::STANDARD, user_configured);
257 SetColor(HighlightElementType::NUMERIC_CONSTANT, PrintColor::YELLOW, PrintIntensity::STANDARD, user_configured);
258 SetColor(HighlightElementType::CONTINUATION_SELECTED, PrintColor::GREEN, PrintIntensity::STANDARD,
259 user_configured);
260 SetColor(HighlightElementType::PROMPT, PrintColor::DARKORANGE, PrintIntensity::BOLD, user_configured);
261 SetColor(HighlightElementType::DATABASE_NAME, PrintColor::ORANGE3, PrintIntensity::STANDARD, user_configured);
262 SetColor(HighlightElementType::SCHEMA_NAME, PrintColor::DEEPSKYBLUE1, PrintIntensity::STANDARD,
263 user_configured);
264 }
265
266 if (mode == HighlightMode::DARK_MODE) {
267 SetColor(HighlightElementType::KEYWORD, PrintColor::DODGERBLUE1, PrintIntensity::BOLD, user_configured);
268 SetColor(HighlightElementType::STRING_CONSTANT, PrintColor::GOLD1, PrintIntensity::STANDARD, user_configured);
269 SetColor(HighlightElementType::NUMERIC_CONSTANT, PrintColor::ORCHID2, PrintIntensity::STANDARD,
270 user_configured);
271 SetColor(HighlightElementType::CONTINUATION_SELECTED, PrintColor::DODGERBLUE1, PrintIntensity::STANDARD,
272 user_configured);
273 SetColor(HighlightElementType::ERROR_TOKEN, PrintColor::INDIANRED3, PrintIntensity::STANDARD, user_configured);
274 SetColor(HighlightElementType::ERROR_EMPHASIS, PrintColor::INDIANRED3, PrintIntensity::BOLD, user_configured);
275 SetColor(HighlightElementType::ERROR_SUGGESTION, PrintColor::INDIANRED3, PrintIntensity::BOLD, user_configured);
276 }
277
278 if (mode == HighlightMode::LIGHT_MODE) {
279 SetColor(HighlightElementType::KEYWORD, PrintColor::DODGERBLUE2, PrintIntensity::BOLD, user_configured);
280 SetColor(HighlightElementType::STRING_CONSTANT, PrintColor::ORANGE4, PrintIntensity::STANDARD, user_configured);
281 SetColor(HighlightElementType::NUMERIC_CONSTANT, PrintColor::DARKMAGENTA, PrintIntensity::STANDARD,
282 user_configured);
283 SetColor(HighlightElementType::CONTINUATION_SELECTED, PrintColor::DODGERBLUE2, PrintIntensity::STANDARD,
284 user_configured);
285 SetColor(HighlightElementType::PROMPT, PrintColor::DARKORANGE4, PrintIntensity::BOLD, user_configured);
286 SetColor(HighlightElementType::ERROR_TOKEN, PrintColor::RED3, PrintIntensity::STANDARD, user_configured);
287 SetColor(HighlightElementType::ERROR_EMPHASIS, PrintColor::RED3, PrintIntensity::BOLD, user_configured);
288 SetColor(HighlightElementType::ERROR_SUGGESTION, PrintColor::RED3, PrintIntensity::BOLD, user_configured);
289 SetColor(HighlightElementType::DATABASE_NAME, PrintColor::DARKORANGE4, PrintIntensity::STANDARD,
290 user_configured);
291 SetColor(HighlightElementType::SCHEMA_NAME, PrintColor::DEEPSKYBLUE6, PrintIntensity::STANDARD,
292 user_configured);
293 }
294}
295
296void ShellHighlight::SetColor(HighlightElementType element_type, PrintColor print_color, PrintIntensity intensity,
297 bool user_configured) {

Callers 3

ToggleHighlightModeFunction · 0.80
DetectDarkLightModeMethod · 0.80
SetColorSchemeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected