How to change the colors of a theme

Hi all,
how is it possible to change the colors of a theme?
For example i like to use the eclipse theme but i don’t like the background color of the tab.
How can i change this color for all tabs?
I found out that you can change the color of a dockable by modifying it’s color map. But i’m looking for an easy way to update the colors of all views.

Thanks in advance for any suggestions!
Greetings, -chris-

Every DockTheme uses a ColorScheme to specify its colors. Also every DockTheme provides a key for changing this ColorScheme in the DockProperties. The ColorScheme itself is not much more than a String-Color map. Replacing it could look like this:


import java.awt.Color;

import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JPanel;

import bibliothek.extension.gui.dock.theme.EclipseTheme;
import bibliothek.extension.gui.dock.theme.eclipse.EclipseColorScheme;
import bibliothek.gui.dock.common.*;
import bibliothek.gui.dock.common.layout.ThemeMap;
import bibliothek.gui.dock.common.menu.SingleCDockableListMenuPiece;
import bibliothek.gui.dock.facile.menu.RootMenuPiece;

public class Dock {
	public static void main( String[] args ){
		JFrame frame = new JFrame( "Demo" );
		CControl control = new CControl( frame );

// >>>>>>>>> Start changing the colors
		control.setTheme( ThemeMap.KEY_ECLIPSE_THEME );
		control.putProperty( EclipseTheme.ECLIPSE_COLOR_SCHEME, new EclipseColorScheme(){
			@Override
			public boolean updateUI(){
				super.updateUI();
				
				setColor( "stack.tab.top", Color.RED );
				setColor( "stack.tab.top.selected", Color.RED );
				
				setColor( "stack.tab.bottom", new Color( 200, 0, 0 ) );
				setColor( "stack.tab.bottom.selected", new Color( 200, 0, 0 ) );
				
				return true;
			}
		});
// >>>>>> end changing the colors
		frame.add( control.getContentArea() );

		CGrid grid = new CGrid( control );
		grid.add( 0, 0, 1, 1, createDockable( "Red", Color.RED ) );
		grid.add( 0, 1, 1, 1, createDockable( "Green", Color.GREEN ) );
		grid.add( 1, 0, 1, 1, createDockable( "Blue", Color.BLUE ) );
		grid.add( 1, 1, 1, 1, createDockable( "Yellow", Color.YELLOW ) );
		control.getContentArea().deploy( grid );

		SingleCDockable black = createDockable( "Black", Color.BLACK );
		control.add( black );
		black.setLocation( CLocation.base().minimalNorth() );
		black.setVisible( true );

		RootMenuPiece menu = new RootMenuPiece( "Colors", false );
		menu.add( new SingleCDockableListMenuPiece( control ));
		JMenuBar menuBar = new JMenuBar();
		menuBar.add( menu.getMenu() );
		frame.setJMenuBar( menuBar );

		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		frame.setBounds( 20, 20, 400, 400 );
		frame.setVisible( true );
	}

	public static SingleCDockable createDockable( String title, Color color ) {
		JPanel panel = new JPanel();
		panel.setOpaque( true );
		panel.setBackground( color );
		DefaultSingleCDockable dockable = new DefaultSingleCDockable( title, title, panel );
		dockable.setCloseable( true );
		return dockable;
	}
}```

Hi Beni,
thanks very much for this example!!

Greetings, -chris-