2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 11:46:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * SPDX-License-Identifier: BSD-2-Clause
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 11:46:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "CSSKeywordValue.h"
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <LibGfx/Palette.h>
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 17:17:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/CSS/SystemColor.h>
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/DOM/Document.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/Layout/Node.h>
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-19 19:16:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <LibWeb/Page/Page.h>
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace Web::CSS {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-07 00:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								String CSSKeywordValue::to_string(SerializationMode) const
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return MUST(String::from_utf8(string_from_keyword(keyword())));
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool CSSKeywordValue::is_color(Keyword keyword)
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    switch (keyword) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Accentcolor:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Accentcolortext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Activeborder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Activecaption:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Activetext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Appworkspace:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Background:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonborder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonface:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonhighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttontext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Canvas:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Canvastext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Captiontext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Currentcolor:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Field:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Fieldtext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Graytext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Highlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Highlighttext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Inactiveborder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Inactivecaption:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Inactivecaptiontext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Infobackground:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Infotext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteBase:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteBaseText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteButton:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteButtonText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteDesktopBackground:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteFocusOutline:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHighlightWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHighlightWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHighlightWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHoverHighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveSelection:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveSelectionText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuBase:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuBaseText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuSelection:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuSelectionText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuStripe:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMovingWindowBorder1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMovingWindowBorder2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMovingWindowTitle:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRubberBandBorder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRubberBandFill:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRuler:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRulerActiveText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRulerBorder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRulerInactiveText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSelection:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSelectionText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxComment:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxControlKeyword:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxIdentifier:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxKeyword:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxNumber:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxOperator:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxPreprocessorStatement:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxPreprocessorValue:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxPunctuation:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxString:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteTextCursor:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteThreedHighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteThreedShadow1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteThreedShadow2:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteVisitedLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteWindow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteWindowText:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Linktext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Mark:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Marktext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Menu:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Menutext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Scrollbar:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Selecteditem:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Selecteditemtext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threeddarkshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedface:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedhighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedlightshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Visitedtext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Window:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Windowframe:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Windowtext:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 11:46:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								bool CSSKeywordValue::has_color() const
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 15:40:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return is_color(keyword());
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 15:40:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 11:46:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Color CSSKeywordValue::to_color(Optional<Layout::NodeWithStyle const&> node) const
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (keyword() == Keyword::Currentcolor) {
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-19 18:31:00 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if (!node.has_value() || !node->has_style())
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            return Color::Black;
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-19 18:31:00 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return node->computed_values().color();
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    PreferredColorScheme scheme = PreferredColorScheme::Light;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (node.has_value()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        scheme = node->computed_values().color_scheme();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // First, handle <system-color>s, since they don't strictly require a node.
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 17:17:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // https://www.w3.org/TR/css-color-4/#css-system-colors
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // https://www.w3.org/TR/css-color-4/#deprecated-system-colors
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    switch (keyword()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Accentcolor:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::accent_color(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Accentcolortext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::accent_color_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonborder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Activeborder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Inactiveborder:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threeddarkshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedhighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedlightshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Windowframe:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::button_border(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonface:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonhighlight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttonshadow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Threedface:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::button_face(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Buttontext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::button_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Canvas:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Appworkspace:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Background:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Inactivecaption:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Infobackground:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Menu:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Scrollbar:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Window:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::canvas(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Canvastext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Activecaption:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Captiontext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Infotext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Menutext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Windowtext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::canvas_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Field:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::field(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Fieldtext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::field_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Graytext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Inactivecaptiontext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::gray_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Highlight:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::highlight(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Highlighttext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::highlight_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Mark:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::mark(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Marktext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::mark_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Selecteditem:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::selected_item(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Selecteditemtext:
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return SystemColor::selected_item_text(scheme);
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-23 17:17:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-19 18:31:00 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (!node.has_value()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // FIXME: Can't resolve palette colors without layout node.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return Color::Black;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-02 12:59:09 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto const& document = node->document();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    switch (keyword()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebLink:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Linktext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return document.normal_link_color().value_or(SystemColor::link_text(scheme));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Visitedtext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return document.visited_link_color().value_or(SystemColor::visited_text(scheme));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::Activetext:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return document.active_link_color().value_or(SystemColor::active_text(scheme));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-12-15 15:41:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    auto palette = document.page().palette();
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    switch (keyword()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteDesktopBackground:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::DesktopBackground);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMovingWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MovingWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMovingWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MovingWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMovingWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MovingWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHighlightWindowBorder1:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HighlightWindowBorder1);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHighlightWindowBorder2:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HighlightWindowBorder2);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHighlightWindowTitle:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HighlightWindowTitle);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuStripe:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuStripe);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuBase:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuBase);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuBaseText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuBaseText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuSelection:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuSelection);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteMenuSelectionText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::MenuSelectionText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteWindow:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Window);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteWindowText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::WindowText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteButton:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Button);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteButtonText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ButtonText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteBase:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Base);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteBaseText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::BaseText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteThreedHighlight:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ThreedHighlight);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteThreedShadow1:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ThreedShadow1);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteThreedShadow2:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ThreedShadow2);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteHoverHighlight:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::HoverHighlight);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSelection:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Selection);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSelectionText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SelectionText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveSelection:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveSelection);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteInactiveSelectionText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::InactiveSelectionText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRubberBandFill:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RubberBandFill);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRubberBandBorder:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RubberBandBorder);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteLink:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Link);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteActiveLink:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::ActiveLink);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteVisitedLink:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::VisitedLink);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRuler:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::Ruler);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRulerBorder:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RulerBorder);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRulerActiveText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RulerActiveText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteRulerInactiveText:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::RulerInactiveText);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteTextCursor:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::TextCursor);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteFocusOutline:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::FocusOutline);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxComment:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxComment);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxNumber:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxNumber);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxString:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxString);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxType:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxType);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxPunctuation:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxPunctuation);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxOperator:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxOperator);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxKeyword:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxKeyword);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxControlKeyword:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxControlKeyword);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxIdentifier:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxIdentifier);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxPreprocessorStatement:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxPreprocessorStatement);
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-14 14:06:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    case Keyword::LibwebPaletteSyntaxPreprocessorValue:
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 15:04:24 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return palette.color(ColorRole::SyntaxPreprocessorValue);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |