Browse Source

Added example images, added base16.el output format

pull/1/head
Macoy Madson 2 years ago
parent
commit
fc2aa05bb0
7 changed files with 105 additions and 6 deletions
  1. +29
    -5
      AutoBase16Theme.py
  2. +2
    -1
      ReadMe.org
  3. +37
    -0
      base16-my-auto-theme.el
  4. +37
    -0
      emacs-base16-theme-template.el
  5. BIN
      images/EarlyTest.png
  6. BIN
      images/Example1.jpg
  7. BIN
      images/Example2.jpg

+ 29
- 5
AutoBase16Theme.py View File

@ -23,6 +23,12 @@ Base16 Style (from https://github.com/chriskempson/base16/blob/master/styling.md
base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
"""
# TODO: Add other options for templates (take as a command line argument)
outputTemplateFilename = 'emacs-base16-theme-template.el'
outputFilename = 'base16-my-auto-theme.el'
# The index for the darkest background color. This is important to make sure contrast is high enough
# between the darkest background color and the darkest text
BACKGROUND_COLOR_INDEX = 0
class Base16Color:
@ -66,7 +72,8 @@ def pickDarkestHighContrastColorUnique(base16Colors, currentBase16Color, colorPo
minimumDarkContrast = 56
viableColors = []
for color in colorPool:
if getColorAverageBrightness(color) - getColorAverageBrightness(base16Colors[BACKGROUND_COLOR_INDEX].color) > minimumDarkContrast:
if (getColorAverageBrightness(color)
- getColorAverageBrightness(base16Colors[BACKGROUND_COLOR_INDEX].color) > minimumDarkContrast):
viableColors.append(color)
viableColors = sorted(viableColors,
@ -81,13 +88,15 @@ def pickDarkestHighContrastColorUnique(base16Colors, currentBase16Color, colorPo
return bestColor
# Pick high contrast foreground (high contrast = a minimum brightness difference between this and the brightest background)
# Pick high contrast foreground
# High contrast = a minimum brightness difference between this and the brightest background)
def pickHighContrastBrightColorRandom(base16Colors, currentBase16Color, colorPool):
minimumBrightContrast = 92
viableColors = []
for color in colorPool:
if getColorAverageBrightness(color) - getColorAverageBrightness(base16Colors[BACKGROUND_COLOR_INDEX].color) > minimumBrightContrast:
if (getColorAverageBrightness(color)
- getColorAverageBrightness(base16Colors[BACKGROUND_COLOR_INDEX].color) > minimumBrightContrast):
viableColors.append(color)
if not viableColors:
@ -170,8 +179,23 @@ def main():
print('Selected {} for {}'.format(base16Colors[i].color, base16Color.name))
# Output selected colors
# TODO: implement
outputTemplateFile = open(outputTemplateFilename, 'r')
outputTemplate = ''.join(outputTemplateFile.readlines())
outputTemplateFile.close()
outputText = outputTemplate.format(base16Colors[0].color, base16Colors[1].color,
base16Colors[2].color, base16Colors[3].color,
base16Colors[4].color, base16Colors[5].color,
base16Colors[6].color, base16Colors[7].color,
base16Colors[8].color, base16Colors[9].color,
base16Colors[10].color, base16Colors[11].color,
base16Colors[12].color, base16Colors[13].color,
base16Colors[14].color, base16Colors[15].color)
outputFile = open(outputFilename, 'w')
outputFile.write(outputText)
outputFile.close()
print('Wrote {} using template {}', outputFilename, outputTemplateFilename)
if __name__ == '__main__':
main()

+ 2
- 1
ReadMe.org View File

@ -14,4 +14,5 @@ Run the following command, replacing "your image" with the image you want the th
Automating the execution of this so that it updates with your desktop background is left as an exercise for the reader :).
** Example results
[[./images/EarlyTest.png]]
[[./images/Example1.png]]
[[./images/Example2.png]]

+ 37
- 0
base16-my-auto-theme.el View File

@ -0,0 +1,37 @@
;;
;; Custom theme
;;
(require 'base16-theme)
(defvar base16-my-auto-colors
'(:base00 "#000000"
:base01 "#17181b"
:base02 "#302429"
:base03 "#c0c3b9"
:base04 "#423439"
:base05 "#4b4b4b"
:base06 "#755253"
:base07 "#656562"
:base08 "#a2a7a1"
:base09 "#8d646d"
:base0A "#a2a7a1"
:base0B "#c0c3b9"
:base0C "#a2a7a1"
:base0D "#755253"
:base0E "#755253"
:base0F "#a2a7a1")
"All colors for Base16 Macoy are defined here.")
;; Define the theme
(deftheme base16-my-auto)
;; Add all the faces to the theme
(base16-theme-define 'base16-my-auto base16-my-auto-colors)
;; Mark the theme as provided
(provide-theme 'base16-my-auto)
(provide 'base16-my-auto-theme)
;;; base16-my-auto-theme.el ends here

+ 37
- 0
emacs-base16-theme-template.el View File

@ -0,0 +1,37 @@
;;
;; Custom theme
;;
(require 'base16-theme)
(defvar base16-my-auto-colors
'(:base00 "{}"
:base01 "{}"
:base02 "{}"
:base03 "{}"
:base04 "{}"
:base05 "{}"
:base06 "{}"
:base07 "{}"
:base08 "{}"
:base09 "{}"
:base0A "{}"
:base0B "{}"
:base0C "{}"
:base0D "{}"
:base0E "{}"
:base0F "{}")
"All colors for Base16 Macoy are defined here.")
;; Define the theme
(deftheme base16-my-auto)
;; Add all the faces to the theme
(base16-theme-define 'base16-my-auto base16-my-auto-colors)
;; Mark the theme as provided
(provide-theme 'base16-my-auto)
(provide 'base16-my-auto-theme)
;;; base16-my-auto-theme.el ends here

BIN
images/EarlyTest.png View File

Before After
Width: 3840  |  Height: 2160  |  Size: 5.2 MiB

BIN
images/Example1.jpg View File

Before After
Width: 3840  |  Height: 2160  |  Size: 1.4 MiB

BIN
images/Example2.jpg View File

Before After
Width: 3840  |  Height: 2160  |  Size: 758 KiB

Loading…
Cancel
Save