mirror of
https://github.com/docmost/docmost.git
synced 2026-08-19 12:41:37 +10:00
fix highlight color
This commit is contained in:
+1
-1
Submodule apps/server/src/ee updated: ffe5c9fd07...1ecd90b9e9
@@ -0,0 +1,41 @@
|
||||
import { mapConfluenceHighlightColor } from './confluence-highlight-color';
|
||||
|
||||
describe('mapConfluenceHighlightColor', () => {
|
||||
it('maps named DC colours to the Docmost table palette', () => {
|
||||
expect(mapConfluenceHighlightColor('grey')).toEqual({
|
||||
color: '#eaecef',
|
||||
name: 'gray',
|
||||
});
|
||||
expect(mapConfluenceHighlightColor('red')).toEqual({
|
||||
color: '#ffbead',
|
||||
name: 'red',
|
||||
});
|
||||
expect(mapConfluenceHighlightColor('yellow')).toEqual({
|
||||
color: '#fef1b4',
|
||||
name: 'yellow',
|
||||
});
|
||||
});
|
||||
|
||||
it('is case- and whitespace-insensitive', () => {
|
||||
expect(mapConfluenceHighlightColor(' Grey ')).toEqual({
|
||||
color: '#eaecef',
|
||||
name: 'gray',
|
||||
});
|
||||
});
|
||||
|
||||
it('maps teal to the closest Docmost colour', () => {
|
||||
expect(mapConfluenceHighlightColor('teal')).toEqual({
|
||||
color: '#b4d5ff',
|
||||
name: 'blue',
|
||||
});
|
||||
});
|
||||
|
||||
it('passes hex values through untouched', () => {
|
||||
expect(mapConfluenceHighlightColor('#f4f5f7')).toEqual({
|
||||
color: '#f4f5f7',
|
||||
});
|
||||
expect(mapConfluenceHighlightColor('#4c9aff')).toEqual({
|
||||
color: '#4c9aff',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
const CONFLUENCE_HIGHLIGHT_TO_DOCMOST: Record<
|
||||
string,
|
||||
{ color: string; name: string }
|
||||
> = {
|
||||
grey: { color: '#eaecef', name: 'gray' },
|
||||
gray: { color: '#eaecef', name: 'gray' },
|
||||
blue: { color: '#b4d5ff', name: 'blue' },
|
||||
teal: { color: '#b4d5ff', name: 'blue' },
|
||||
green: { color: '#acf5d2', name: 'green' },
|
||||
yellow: { color: '#fef1b4', name: 'yellow' },
|
||||
red: { color: '#ffbead', name: 'red' },
|
||||
purple: { color: '#c1b7f2', name: 'purple' },
|
||||
};
|
||||
|
||||
export function mapConfluenceHighlightColor(colour: string): {
|
||||
color: string;
|
||||
name?: string;
|
||||
} {
|
||||
return (
|
||||
CONFLUENCE_HIGHLIGHT_TO_DOCMOST[colour.trim().toLowerCase()] ?? {
|
||||
color: colour,
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user