11/*
2- * Copyright (c) 2018, 2023 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2018, 2024 , Oracle and/or its affiliates. All rights reserved.
33 *
44 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55 *
134134import org .openjdk .jmc .ui .UIPlugin ;
135135import org .openjdk .jmc .ui .accessibility .FocusTracker ;
136136import org .openjdk .jmc .ui .common .util .AdapterUtil ;
137+ import org .openjdk .jmc .ui .common .util .ThemeUtils ;
137138import org .openjdk .jmc .ui .handlers .ActionToolkit ;
138139import org .openjdk .jmc .ui .handlers .CopySelectionAction ;
139140import org .openjdk .jmc .ui .handlers .InFocusHandlerActivator ;
@@ -212,8 +213,10 @@ public void run() {
212213 private static final Color ALTERNATE_COLOR = SWTColorToolkit .getColor (new RGB (255 , 255 , 240 ));
213214 private static final String COUNT_IMG_KEY = "countColor" ; //$NON-NLS-1$
214215 private static final Color COUNT_COLOR = SWTColorToolkit .getColor (new RGB (100 , 200 , 100 ));
216+ private static final Color COUNT_COLOR_DARK_MODE = SWTColorToolkit .getColor (new RGB (7 , 94 , 7 ));
215217 private static final String SIBLINGS_IMG_KEY = "siblingsColor" ; //$NON-NLS-1$
216218 private static final Color SIBLINGS_COUNT_COLOR = SWTColorToolkit .getColor (new RGB (170 , 250 , 170 ));
219+ private static final Color SIBLINGS_COUNT_COLOR_DARK_MODE = SWTColorToolkit .getColor (new RGB (8 , 115 , 8 ));
217220 private static final int [] DEFAULT_COLUMN_WIDTHS = {650 , 80 , 120 };
218221 private static final String THREAD_ROOT_KEY = "threadRootAtTop" ; //$NON-NLS-1$
219222 private static final String FRAME_OPTIMIZATION_KEY = "distinguishFramesByOptimization" ; //$NON-NLS-1$
@@ -860,12 +863,13 @@ public void handleEvent(Event event) {
860863 long forkOffset = parentFork .getItemOffset ();
861864 int siblingsStart = (int ) Math .floor (event .width * forkOffset / total );
862865 int siblingsWidth = (int ) Math .round (event .width * parentFork .getAggregateItemsInFork () / total );
863- event .gc .setBackground (SIBLINGS_COUNT_COLOR );
866+ event .gc .setBackground (
867+ ThemeUtils .isDarkTheme () ? SIBLINGS_COUNT_COLOR_DARK_MODE : SIBLINGS_COUNT_COLOR );
864868 event .gc .fillRectangle (event .x + siblingsStart , event .y , siblingsWidth , event .height );
865869 // Draw group
866870 double offset = (forkOffset + frame .getBranch ().getItemOffsetInFork ()) / total ;
867871 double fraction = frame .getAttributeAggregate () / total ;
868- event .gc .setBackground (COUNT_COLOR );
872+ event .gc .setBackground (ThemeUtils . isDarkTheme () ? COUNT_COLOR_DARK_MODE : COUNT_COLOR );
869873 int startPixel = (int ) Math .floor (event .width * offset );
870874 int widthPixel = (int ) Math .round (event .width * fraction );
871875 event .gc .fillRectangle (event .x + startPixel , event .y , Math .max (widthPixel , 1 ), event .height );
@@ -886,12 +890,13 @@ public void handleEvent(Event event) {
886890 long forkOffset = parentFork .getItemOffset ();
887891 int siblingsStart = (int ) Math .floor (event .width * forkOffset / total );
888892 int siblingsWidth = (int ) Math .round (event .width * parentFork .getAggregateItemsInFork () / total );
889- event .gc .setBackground (SIBLINGS_COUNT_COLOR );
893+ event .gc .setBackground (
894+ ThemeUtils .isDarkTheme () ? SIBLINGS_COUNT_COLOR_DARK_MODE : SIBLINGS_COUNT_COLOR );
890895 event .gc .fillRectangle (event .x + siblingsStart , event .y , siblingsWidth , event .height );
891896 // Draw group
892897 double offset = (forkOffset + frame .getBranch ().getItemOffsetInFork ()) / total ;
893898 double fraction = frame .getAttributeAggregate () / total ;
894- event .gc .setBackground (COUNT_COLOR );
899+ event .gc .setBackground (ThemeUtils . isDarkTheme () ? COUNT_COLOR_DARK_MODE : COUNT_COLOR );
895900 int startPixel = (int ) Math .floor (event .width * offset );
896901 int widthPixel = (int ) Math .round (event .width * fraction );
897902 event .gc .fillRectangle (event .x + startPixel , event .y , Math .max (widthPixel , 1 ), event .height );
@@ -1057,7 +1062,7 @@ public Image getImage(Object element) {
10571062
10581063 @ Override
10591064 public Color getBackground (Object element ) {
1060- if (treeLayout ) {
1065+ if (treeLayout || ThemeUtils . isDarkTheme () ) {
10611066 return null ;
10621067 } else {
10631068 int parentCount = 0 ;
0 commit comments