Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dylanaraps/pywal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.2.5
Choose a base ref
...
head repository: dylanaraps/pywal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.2.6
Choose a head ref
  • 9 commits
  • 7 files changed
  • 1 contributor

Commits on Jun 27, 2017

  1. Copy the full SHA
    1ede83a View commit details
  2. tests: Remove unused line.

    dylanaraps committed Jun 27, 2017
    Copy the full SHA
    bb81f1a View commit details
  3. Copy the full SHA
    b5c27de View commit details
  4. General: Fix test.

    dylanaraps committed Jun 27, 2017
    Copy the full SHA
    d82de89 View commit details
  5. DOCS: CONTRIBUTING

    dylanaraps committed Jun 27, 2017
    Copy the full SHA
    3121a1a View commit details

Commits on Jun 28, 2017

  1. Copy the full SHA
    c00df33 View commit details
  2. version: bump

    dylanaraps committed Jun 28, 2017
    Copy the full SHA
    c067948 View commit details
  3. General: Fix wallpaper bug

    dylanaraps committed Jun 28, 2017
    Copy the full SHA
    153a7f9 View commit details
  4. Copy the full SHA
    a249f20 View commit details
Showing with 25 additions and 21 deletions.
  1. +1 −1 CONTRIBUTING.md
  2. +7 −7 pywal/export_colors.py
  3. 0 pywal/{format_color.py → format_colors.py}
  4. +8 −3 pywal/gen_colors.py
  5. +1 −1 pywal/settings.py
  6. +1 −2 tests/test_export_colors.py
  7. +7 −7 tests/test_format_colors.py
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ pip install flake8 pylint

### Tests

Tests haven't been written yet.
`wal` can be tested by running `python setup.py test` in the root directory of the repo.


### Commit Message Style
14 changes: 7 additions & 7 deletions pywal/export_colors.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@

from pywal.settings import CACHE_DIR
from pywal import util
from pywal import format_color
from pywal import format_colors


def save_colors(colors, export_file, message):
@@ -30,25 +30,25 @@ def reload_i3():

def export_colors(colors):
"""Export colors in various formats."""
plain_colors = format_color.plain(colors)
plain_colors = format_colors.plain(colors)
save_colors(plain_colors, "colors", "plain hex colors")

# Shell based colors.
shell_colors = format_color.shell(colors)
shell_colors = format_colors.shell(colors)
save_colors(shell_colors, "colors.sh", "shell variables")

# Web based colors.
css_colors = format_color.css(colors)
css_colors = format_colors.css(colors)
save_colors(css_colors, "colors.css", "css variables")
scss_colors = format_color.scss(colors)
scss_colors = format_colors.scss(colors)
save_colors(scss_colors, "colors.scss", "scss variables")

# Text editor based colors.
putty_colors = format_color.putty(colors)
putty_colors = format_colors.putty(colors)
save_colors(putty_colors, "colors-putty.reg", "putty theme")

# X based colors.
xrdb_colors = format_color.xrdb(colors)
xrdb_colors = format_colors.xrdb(colors)
save_colors(xrdb_colors, "xcolors", "xrdb colors")

# i3 colors.
File renamed without changes.
11 changes: 8 additions & 3 deletions pywal/gen_colors.py
Original file line number Diff line number Diff line change
@@ -22,10 +22,15 @@ def random_img(img_dir):

# Add all images to a list excluding the current wallpaper.
file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif")
images = [img for img in os.listdir(img_dir)
if img.endswith(file_types) and img != current_wall]
images = [img for img in os.scandir(img_dir)
if img.name.endswith(file_types) and img.name != current_wall]

return pathlib.Path(img_dir / random.choice(images))
# If no images are found, use the current wallpaper.
if not images:
print("image: No new images found (nothing to do), exiting...")
quit(1)

return pathlib.Path(img_dir / random.choice(images).name)


def get_image(img):
2 changes: 1 addition & 1 deletion pywal/settings.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
import pathlib


__version__ = "0.2.5"
__version__ = "0.2.6"


# Internal variables.
3 changes: 1 addition & 2 deletions tests/test_export_colors.py
Original file line number Diff line number Diff line change
@@ -16,8 +16,7 @@ class TestExportColors(unittest.TestCase):
def test_save_colors(self):
"""> Export colors to a file."""
tmp_file = pathlib.Path("/tmp/test_file")
colors = util.read_file("tests/test_files/test_file")
export_colors.save_colors(colors, tmp_file, "plain colors")
export_colors.save_colors(COLORS, tmp_file, "plain colors")
result = tmp_file.is_file()
self.assertTrue(result)

14 changes: 7 additions & 7 deletions tests/test_format_colors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test format functions."""
import unittest

from pywal import format_color
from pywal import format_colors
from pywal import util


@@ -14,32 +14,32 @@ class TestFormatColors(unittest.TestCase):

def test_plain(self):
"""> Convert colors to plain."""
result = format_color.plain(COLORS)
result = format_colors.plain(COLORS)
self.assertEqual(result[0], "#363442\n")

def test_shell(self):
"""> Convert colors to shell variables."""
result = format_color.shell(COLORS)
result = format_colors.shell(COLORS)
self.assertEqual(result[0], "color0='#363442'\n")

def test_css(self):
"""> Convert colors to css variables."""
result = format_color.css(COLORS)
result = format_colors.css(COLORS)
self.assertEqual(result[1], "\t--color0: #363442;\n")

def test_scss(self):
"""> Convert colors to scss variables."""
result = format_color.scss(COLORS)
result = format_colors.scss(COLORS)
self.assertEqual(result[0], "$color0: #363442;\n")

def test_putty(self):
"""> Convert colors to putty theme."""
result = format_color.putty(COLORS)
result = format_colors.putty(COLORS)
self.assertEqual(result[2], "\"colour0\"=\"54,52,66\"\n")

def test_xrdb(self):
"""> Convert colors to putty theme."""
result = format_color.xrdb(COLORS)
result = format_colors.xrdb(COLORS)
self.assertEqual(result[6], "*.color0: #363442\n*color0: #363442\n")