@@ -1376,22 +1376,33 @@ var (
1376
1376
}
1377
1377
)
1378
1378
1379
+ // colorChoice returns a hex color code from the actual color values.
1380
+ func (clr * decodeCTColor ) colorChoice () * string {
1381
+ if clr .SrgbClr != nil {
1382
+ return clr .SrgbClr .Val
1383
+ }
1384
+ if clr .SysClr != nil {
1385
+ return & clr .SysClr .LastClr
1386
+ }
1387
+ return nil
1388
+ }
1389
+
1379
1390
// GetBaseColor returns the preferred hex color code by giving hex color code,
1380
1391
// indexed color, and theme color.
1381
1392
func (f * File ) GetBaseColor (hexColor string , indexedColor int , themeColor * int ) string {
1382
1393
if f .Theme != nil && themeColor != nil {
1383
1394
clrScheme := f .Theme .ThemeElements .ClrScheme
1384
1395
if val , ok := map [int ]* string {
1385
- 0 : & clrScheme .Lt1 .SysClr . LastClr ,
1386
- 1 : & clrScheme .Dk1 .SysClr . LastClr ,
1387
- 2 : clrScheme .Lt2 .SrgbClr . Val ,
1388
- 3 : clrScheme .Dk2 .SrgbClr . Val ,
1389
- 4 : clrScheme .Accent1 .SrgbClr . Val ,
1390
- 5 : clrScheme .Accent2 .SrgbClr . Val ,
1391
- 6 : clrScheme .Accent3 .SrgbClr . Val ,
1392
- 7 : clrScheme .Accent4 .SrgbClr . Val ,
1393
- 8 : clrScheme .Accent5 .SrgbClr . Val ,
1394
- 9 : clrScheme .Accent6 .SrgbClr . Val ,
1396
+ 0 : clrScheme .Lt1 .colorChoice () ,
1397
+ 1 : clrScheme .Dk1 .colorChoice () ,
1398
+ 2 : clrScheme .Lt2 .colorChoice () ,
1399
+ 3 : clrScheme .Dk2 .colorChoice () ,
1400
+ 4 : clrScheme .Accent1 .colorChoice () ,
1401
+ 5 : clrScheme .Accent2 .colorChoice () ,
1402
+ 6 : clrScheme .Accent3 .colorChoice () ,
1403
+ 7 : clrScheme .Accent4 .colorChoice () ,
1404
+ 8 : clrScheme .Accent5 .colorChoice () ,
1405
+ 9 : clrScheme .Accent6 .colorChoice () ,
1395
1406
}[* themeColor ]; ok && val != nil {
1396
1407
return * val
1397
1408
}
0 commit comments