diff --git a/word/Editor/Styles.js b/word/Editor/Styles.js index 07e49b7a1d..06eab2926d 100644 --- a/word/Editor/Styles.js +++ b/word/Editor/Styles.js @@ -9483,38 +9483,27 @@ CDocumentColor.prototype.ToHexColor = function() { CDocumentColor.prototype.ToHighlightColor = function() { // 17.18.40 ST_HighlightColor - if (0x00 === this.r && 0x00 === this.g && 0x00 === this.b) - return "black"; - else if (0x00 === this.r && 0x00 === this.g && 0xFF === this.b) - return "blue"; - else if (0x00 === this.r && 0xFF === this.g && 0xFF === this.b) - return "cyan"; - else if (0x00 === this.r && 0x00 === this.g && 0x8B === this.b) - return "darkBlue"; - else if (0x00 === this.r && 0x8B === this.g && 0x8B === this.b) - return "darkCyan"; - else if (0xA9 === this.r && 0xA9 === this.g && 0xA9 === this.b) - return "darkGray"; - else if (0x00 === this.r && 0x64 === this.g && 0x00 === this.b) - return "darkGreen"; - else if (0x80 === this.r && 0x00 === this.g && 0x80 === this.b) - return "darkMagenta"; - else if (0x8B === this.r && 0x00 === this.g && 0x00 === this.b) - return "darkRed"; - else if (0x80 === this.r && 0x80 === this.g && 0x00 === this.b) - return "darkYellow"; - else if (0x00 === this.r && 0xFF === this.g && 0x00 === this.b) - return "green"; - else if (0xD3 === this.r && 0xD3 === this.g && 0xD3 === this.b) - return "lightGray"; - else if (0xFF === this.r && 0x00 === this.g && 0xFF === this.b) - return "magenta"; - else if (0xFF === this.r && 0x00 === this.g && 0x00 === this.b) - return "red"; - else if (0xFF === this.r && 0xFF === this.g && 0xFF === this.b) - return "white"; - else if (0xFF === this.r && 0xFF === this.g && 0x00 === this.b) - return "yellow"; + let val = (((this.r & 0xFF) << 16) | ((this.b & 0xFF) << 8) | (this.r & 0xFF)); + + switch (val) + { + case 0x000000: return "black"; + case 0x0000FF: return "blue"; + case 0x00FFFF: return "cyan"; + case 0x00008B: return "darkBlue"; + case 0x008B8B: return "darkCyan"; + case 0xA9A9A9: return "darkGray"; + case 0x006400: return "darkGreen"; + case 0x800080: return "darkMagenta"; + case 0x8B0000: return "darkRed"; + case 0x808000: return "darkYellow"; + case 0x00FF00: return "green"; + case 0xD3D3D3: return "lightGray"; + case 0xFF00FF: return "magenta"; + case 0xFF0000: return "red"; + case 0xFFFFFF: return "white"; + case 0xFFFF00: return "yellow"; + } return ""; };