summaryrefslogtreecommitdiff
path: root/propertysheet/src/org/eclipse/wb/draw2d/IColorConstants.java
blob: 4246302ba698c675a7dd5ec9a4c346476b71663f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*******************************************************************************
 * Copyright (c) 2011 Google, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Google, Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.wb.draw2d;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;

/**
 * A collection of color-related constants.
 *
 * @author lobas_av
 * @coverage gef.draw2d
 */
public interface IColorConstants {
  /**
   * System color used to paint highlight shadow areas.
   */
  Color buttonLightest = Utils.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
  /**
   * System color used to paint background areas.
   */
  Color button = Utils.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
  /**
   * System color used to paint normal shadow areas.
   */
  Color buttonDarker = Utils.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
//  /**
//   * System color used to paint dark shadow areas.
//   */
//  Color buttonDarkest = Utils.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
  /**
   * System color used to paint list background areas.
   */
  Color listBackground = Utils.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
  /**
   * System color used to paint list foreground areas.
   */
  Color listForeground = Utils.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
  /**
   * System color used to paint list selection area.
   */
  Color listSelection = Utils.getSystemColor(SWT.COLOR_LIST_SELECTION);
  /**
   * System color used to paint list selection text.
   */
  Color listSelectionText = Utils.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
  /**
   * System color used to paint tooltip text.
   */
  Color tooltipForeground = Utils.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
  /**
   * System color used to paint tooltip background areas.
   */
  Color tooltipBackground = Utils.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
  /**
   * Miscellaneous colors.
   */
  Color lightGray = new Color(null, 192, 192, 192);
  Color gray = new Color(null, 128, 128, 128);
  Color darkGray = new Color(null, 64, 64, 64);
  Color black = new Color(null, 0, 0, 0);
  Color lightBlue = new Color(null, 127, 127, 255);
  Color darkBlue = new Color(null, 0, 0, 127);

  ////////////////////////////////////////////////////////////////////////////
  //
  // Utils
  //
  ////////////////////////////////////////////////////////////////////////////
  /**
   * Internal helper.
   */
  public static class Utils {
    /**
     * Invokes {@link Display#getSystemColor(int)} in UI thread.
     */
    private static Color getSystemColor(final int id) {
      final Color[] color = new Color[1];
      final Display display = Display.getDefault();
      display.syncExec(new Runnable() {
        @Override
        public void run() {
          color[0] = display.getSystemColor(id);
        }
      });
      return color[0];
    }
  }
}