@@ -10,7 +10,8 @@ import log from "./logging";
10
10
export const preferredColorPredicate : string = "https://intertextuality.org/annotation#preferredCssColor" ;
11
11
export const colorPriorityPredicate : string = "https://intertextuality.org/annotation#colorPriority" ;
12
12
13
- export const defaultColor : string = "yellow" ;
13
+ export const visualCategory : string = "background-color" ;
14
+ export const defaultCss : CSSDefinition = { "background-color" : "whitesmoke" } ;
14
15
15
16
/*
16
17
* A thunk for setting the CSS for all annotations. This will update
@@ -32,7 +33,7 @@ export const setCssAnnotationsThunk = () => {
32
33
log . debug ( "setting CSS for annotation : " + annotId ) ;
33
34
// get the annotation by ID
34
35
const annotation = annots [ annotId ] ;
35
- css [ annotId ] = { } ;
36
+ css [ annotId ] = { 0 : defaultCss } ;
36
37
// collect attributed RDF classes into the tags variable
37
38
var tags : any = { }
38
39
// an annotation may have multiple predicates with multiple objects
@@ -50,16 +51,13 @@ export const setCssAnnotationsThunk = () => {
50
51
tags [ clasUri ] = ontology [ clasUri ] ;
51
52
var tag : Predications = ontology [ clasUri ] ;
52
53
// get the CSS properties: background color
53
- if ( ! tag . hasOwnProperty ( preferredColorPredicate ) ) {
54
- css [ annotId ] [ 0 ] = new CSSStyleDeclaration ( ) ;
55
- css [ annotId ] [ 0 ] [ "background-color" ] = defaultColor ;
56
- } else {
54
+ if ( tag . hasOwnProperty ( preferredColorPredicate ) ) {
57
55
var priority : number = 0 ;
58
56
if ( tag . hasOwnProperty ( colorPriorityPredicate ) ) {
59
57
priority = + tag [ colorPriorityPredicate ] [ 0 ] . value ;
60
58
}
61
59
css [ annotId ] [ priority ] = { } ;
62
- css [ annotId ] [ priority ] [ "background-color" ] = tag [ preferredColorPredicate ] [ 0 ] . value ;
60
+ css [ annotId ] [ priority ] [ visualCategory ] = tag [ preferredColorPredicate ] [ 0 ] . value ;
63
61
}
64
62
}
65
63
}
0 commit comments