Return {option:value} dict for elements in themeName. type - string, 'default' or 'user' theme type themeName - string, theme name Values are loaded over ultimate fallback defaults to guarantee that all theme elements are present in a newly created theme.
(self, type, themeName)
| 288 | return {"foreground": fore, "background": back} |
| 289 | |
| 290 | def GetThemeDict(self, type, themeName): |
| 291 | """Return {option:value} dict for elements in themeName. |
| 292 | |
| 293 | type - string, 'default' or 'user' theme type |
| 294 | themeName - string, theme name |
| 295 | Values are loaded over ultimate fallback defaults to guarantee |
| 296 | that all theme elements are present in a newly created theme. |
| 297 | """ |
| 298 | if type == 'user': |
| 299 | cfgParser = self.userCfg['highlight'] |
| 300 | elif type == 'default': |
| 301 | cfgParser = self.defaultCfg['highlight'] |
| 302 | else: |
| 303 | raise InvalidTheme('Invalid theme type specified') |
| 304 | # Provide foreground and background colors for each theme |
| 305 | # element (other than cursor) even though some values are not |
| 306 | # yet used by idle, to allow for their use in the future. |
| 307 | # Default values are generally black and white. |
| 308 | # TODO copy theme from a class attribute. |
| 309 | theme ={'normal-foreground':'#000000', |
| 310 | 'normal-background':'#ffffff', |
| 311 | 'keyword-foreground':'#000000', |
| 312 | 'keyword-background':'#ffffff', |
| 313 | 'builtin-foreground':'#000000', |
| 314 | 'builtin-background':'#ffffff', |
| 315 | 'comment-foreground':'#000000', |
| 316 | 'comment-background':'#ffffff', |
| 317 | 'string-foreground':'#000000', |
| 318 | 'string-background':'#ffffff', |
| 319 | 'definition-foreground':'#000000', |
| 320 | 'definition-background':'#ffffff', |
| 321 | 'hilite-foreground':'#000000', |
| 322 | 'hilite-background':'gray', |
| 323 | 'break-foreground':'#ffffff', |
| 324 | 'break-background':'#000000', |
| 325 | 'hit-foreground':'#ffffff', |
| 326 | 'hit-background':'#000000', |
| 327 | 'error-foreground':'#ffffff', |
| 328 | 'error-background':'#000000', |
| 329 | 'context-foreground':'#000000', |
| 330 | 'context-background':'#ffffff', |
| 331 | 'linenumber-foreground':'#000000', |
| 332 | 'linenumber-background':'#ffffff', |
| 333 | #cursor (only foreground can be set) |
| 334 | 'cursor-foreground':'#000000', |
| 335 | #shell window |
| 336 | 'stdout-foreground':'#000000', |
| 337 | 'stdout-background':'#ffffff', |
| 338 | 'stderr-foreground':'#000000', |
| 339 | 'stderr-background':'#ffffff', |
| 340 | 'console-foreground':'#000000', |
| 341 | 'console-background':'#ffffff', |
| 342 | } |
| 343 | for element in theme: |
| 344 | if not (cfgParser.has_option(themeName, element) or |
| 345 | # Skip warning for new elements. |
| 346 | element.startswith(('context-', 'linenumber-'))): |
| 347 | # Print warning that will return a default color |