private void ok() { notePadMeta = new NotePadMeta(); if ( wDesc.getText() != null ) { notePadMeta.setNote( wDesc.getText() ); } if ( wFontName.getText() != null ) { notePadMeta.setFontName( wFontName.getText() ); } notePadMeta.setFontSize( wFontSize.getSelection() ); notePadMeta.setFontBold( wFontBold.getSelection() ); notePadMeta.setFontItalic( wFontItalic.getSelection() ); // font color notePadMeta.setFontColorRed( wFontColor.getBackground().getRed() ); notePadMeta.setFontColorGreen( wFontColor.getBackground().getGreen() ); notePadMeta.setFontColorBlue( wFontColor.getBackground().getBlue() ); // background color notePadMeta.setBackGroundColorRed( wBackGroundColor.getBackground().getRed() ); notePadMeta.setBackGroundColorGreen( wBackGroundColor.getBackground().getGreen() ); notePadMeta.setBackGroundColorBlue( wBackGroundColor.getBackground().getBlue() ); // border color notePadMeta.setBorderColorRed( wBorderColor.getBackground().getRed() ); notePadMeta.setBorderColorGreen( wBorderColor.getBackground().getGreen() ); notePadMeta.setBorderColorBlue( wBorderColor.getBackground().getBlue() ); notePadMeta.setDrawShadow( wDrawShadow.getSelection() ); dispose(); }
String colorName = "bg " + bg.toString(); r[0] = colorName; r[1] = new Long( ( bg.getRed() << 16 ) + ( bg.getGreen() << 8 ) + ( bg.getBlue() ) );
Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() ); tabFolder.setSelectionBackground( tabColor ); break;
/** {@inheritDoc} */ public Color getBackground() { final org.eclipse.swt.graphics.Color color = gc.getBackground(); final Color awtColor = new Color(color.getRed(), color.getGreen(), color.getBlue()); return awtColor; }
@Override public int[] getForeground() { Color color = getForegroundSWT(); if (color == null) { return new int[3]; } return new int[] { color.getRed(), color.getGreen(), color.getBlue() }; }
/** * Tests if the background is white. White background has RGB value * 255,255,255. * * @return <samp>true</samp> if background is white, <samp>false</samp> * otherwise. */ public boolean isWhiteBackground() { Color bg = getImpliedBackground(); return bg.getRed() == 255 && bg.getGreen() == 255 && bg.getBlue() == 255; }
public static RGBColor getRGBColor(Color color) { int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); return new CSS2RGBColorImpl(red, green, blue); }
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ public String toString () { if (isDisposed()) return "Color {*DISPOSED*}"; return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}"; }
public static int[] colorToIntArray(Color color) { if (color == null || color.isDisposed()) { return null; } return new int[] { color.getRed(), color.getGreen(), color.getBlue() }; }
@Override public int[] getBackground() { Color color = getBackgroundSWT(); if (color == null) { return null; } return new int[] { color.getRed(), color.getGreen(), color.getBlue() }; }
/** * Tests if the background is white. White background has RGB value * 255,255,255. * * @return <samp>true</samp> if background is white, <samp>false</samp> * otherwise. */ public boolean isWhiteBackground() { Color bg = getImpliedBackground(); return bg.getRed() == 255 && bg.getGreen() == 255 && bg.getBlue() == 255; }
private Color computeDashLineColor() { Color fg= fTable.getForeground(); int fGray= (int)(0.3*fg.getRed() + 0.59*fg.getGreen() + 0.11*fg.getBlue()); Color bg= fTable.getBackground(); int bGray= (int)(0.3*bg.getRed() + 0.59*bg.getGreen() + 0.11*bg.getBlue()); int gray= (int)((fGray + bGray) * 0.66); return new Color(fDisplay, gray, gray, gray); }
private Color computeDashLineColor() { Color fg= fTable.getForeground(); int fGray= (int)(0.3*fg.getRed() + 0.59*fg.getGreen() + 0.11*fg.getBlue()); Color bg= fTable.getBackground(); int bGray= (int)(0.3*bg.getRed() + 0.59*bg.getGreen() + 0.11*bg.getBlue()); int gray= (int)((fGray + bGray) * 0.66); return new Color(fDisplay, gray, gray, gray); }
private Color computeDashLineColor() { Color fg= fTable.getForeground(); int fGray= (int)(0.3*fg.getRed() + 0.59*fg.getGreen() + 0.11*fg.getBlue()); Color bg= fTable.getBackground(); int bGray= (int)(0.3*bg.getRed() + 0.59*bg.getGreen() + 0.11*bg.getBlue()); int gray= (int)((fGray + bGray) * 0.66); return new Color(fDisplay, gray, gray, gray); }
public static String getWidgetBGColorURLParam() { Color bg = findAnyShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); byte[] color = new byte[3]; color[0] = (byte) bg.getRed(); color[1] = (byte) bg.getGreen(); color[2] = (byte) bg.getBlue(); return( "bg_color=" + ByteFormatter.nicePrint(color)); }
@Override public int[] getForeground() { if (composite == null || composite.isDisposed()) { return null; } Color fg = composite.getForeground(); return new int[] { fg.getRed(), fg.getGreen(), fg.getBlue() }; }
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ @Override public String toString () { if (isDisposed()) return "Color {*DISPOSED*}"; return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + ", " + getAlpha() +"}"; }
@Override public void setOuterKeyline(Color color) { this.outerKeyline = color; // TODO: HACK! Should be set based on pseudo-state. if (color != null) { setActive(!(color.getRed() == 255 && color.getGreen() == 255 && color.getBlue() == 255)); } parent.redraw(); }
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ @Override public String toString () { if (isDisposed()) return "Color {*DISPOSED*}"; return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + ", " + getAlpha() +"}"; }
@Override public void runSupport() { Color colorTables = Colors.getSystemColor(display, SWT.COLOR_LIST_BACKGROUND); HSLColor hslBG = new HSLColor(); hslBG.initHSLbyRGB(colorTables.getRed(), colorTables.getGreen(), colorTables.getBlue()); int lum = hslBG.getLuminence(); HSLColor hslColor = new HSLColor(); hslColor.initRGBbyHSL(25, 200, 128 + (lum < 160 ? 10 : -10)); colorWarning = new AllocateColor("warning", new RGB(hslColor.getRed(), hslColor.getGreen(), hslColor.getBlue()), colorWarning).getColor(); } }, false);