Source:
<code>private void initializeAppearColorTable(Composite tableComposite) { fAppearanceColorTableViewer.addSelectionChangedListener((SelectionChangedEvent event) -> handleAppearanceColorListSelection()); colorPreviewImages= new ArrayList<>(); fAppearanceColorTableViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { ColorEntry colorEntry= ((ColorEntry) element); if (colorEntry.isSystemDefault() && colorEntry.systemColorRGB == null) return null; int dimensions= 10; <START> RGB rgb= colorEntry.isSystemDefault() ? colorEntry.getSystemColorRGB() : colorEntry.getRGB(); <END> Color color= new Color(tableComposite.getParent().getDisplay(), rgb.red, rgb.green, rgb.blue); Image image= new Image(tableComposite.getParent().getDisplay(), dimensions, dimensions); GC gc= new GC(image); gc.setBackground(color); gc.fillRectangle(0, 0, dimensions, dimensions); gc.setBackground(new Color(tableComposite.getParent().getDisplay(), 0, 0, 0)); gc.setLineWidth(2); gc.drawRectangle(0, 0, dimensions, dimensions); gc.dispose(); color.dispose(); colorPreviewImages.add(image); return image; } @Override public String getText(Object element) { return ((ColorEntry) element).label; } }); TableColumn tc= new TableColumn(fAppearanceColorTableViewer.getTable(), SWT.NONE, 0); TableColumnLayout tableColumnLayout= new TableColumnLayout(true); PixelConverter pixelConverter= new PixelConverter(tableComposite.getParent().getFont()); tableColumnLayout.setColumnData(tc, new ColumnWeightData(1, pixelConverter.convertWidthInCharsToPixels(30))); tableComposite.setLayout(tableColumnLayout); GridData gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH); Table fAppearanceColorTable= fAppearanceColorTableViewer.getTable(); gd.heightHint= fAppearanceColorTable.getItemHeight() * 8; fAppearanceColorTable.setLayoutData(gd); }</code><technical_language>is color black if is set</technical_language>

Target:
private void initializeAppearColorTable(Composite tableComposite) { fAppearanceColorTableViewer.addSelectionChangedListener((SelectionChangedEvent event) -> handleAppearanceColorListSelection()); colorPreviewImages= new ArrayList<>(); fAppearanceColorTableViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { ColorEntry colorEntry= ((ColorEntry) element); Color color; if (colorEntry.isSystemDefault() && colorEntry.systemColorRGB == null) { color= new Color(tableComposite.getParent().getDisplay(), 0, 0, 0); } else { RGB rgb= colorEntry.isSystemDefault() ? colorEntry.systemColorRGB : colorEntry.getRGB(); color= new Color(tableComposite.getParent().getDisplay(), rgb.red, rgb.green, rgb.blue); } int dimensions= 10; Image image= new Image(tableComposite.getParent().getDisplay(), dimensions, dimensions); GC gc= new GC(image); gc.setBackground(color); gc.fillRectangle(0, 0, dimensions, dimensions); gc.setBackground(new Color(tableComposite.getParent().getDisplay(), 0, 0, 0)); gc.setLineWidth(2); gc.drawRectangle(0, 0, dimensions, dimensions); gc.dispose(); color.dispose(); colorPreviewImages.add(image); return image; } @Override public String getText(Object element) { return ((ColorEntry) element).label; } }); TableColumn tc= new TableColumn(fAppearanceColorTableViewer.getTable(), SWT.NONE, 0); TableColumnLayout tableColumnLayout= new TableColumnLayout(true); PixelConverter pixelConverter= new PixelConverter(tableComposite.getParent().getFont()); tableColumnLayout.setColumnData(tc, new ColumnWeightData(1, pixelConverter.convertWidthInCharsToPixels(30))); tableComposite.setLayout(tableColumnLayout); GridData gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH); Table fAppearanceColorTable= fAppearanceColorTableViewer.getTable(); gd.heightHint= fAppearanceColorTable.getItemHeight() * 8; fAppearanceColorTable.setLayoutData(gd); }