How to use the wpgtk.data.color function in wpgtk

To help you get started, we’ve selected a few wpgtk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
name_dic = pywal.theme.list_themes(dark)
        name_list = [t.name.replace(".json", "") for t in name_dic]
        print("\n".join(name_list))
        exit(0)

    if args.sat:
        cl = color.get_color_list(args.sat[0])
        val = float(args.sat[1])
        cl = [util.alter_brightness(x, 0, val) for x in cl]

        color.write_colors(args.sat[0], cl)
        sample.create_sample(cl, files.get_sample_path(args.sat[0]))
        exit(0)

    if args.brt:
        cl = color.get_color_list(args.brt[0])
        val = float(args.brt[1])
        cl = [util.alter_brightness(x, val, 0) for x in cl]

        color.write_colors(args.brt[0], cl)
        sample.create_sample(cl, files.get_sample_path(args.brt[0]))
        exit(0)

    if args.theme and args.theme != "list":
        light = settings['light_theme'] == "true"
        themer.set_pywal_theme(args.theme, light)
        exit(0)

    if args.backend == "list":
        print("\n".join(pywal.colors.list_backends()))
        exit(0)
github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
if args.sat:
        cl = color.get_color_list(args.sat[0])
        val = float(args.sat[1])
        cl = [util.alter_brightness(x, 0, val) for x in cl]

        color.write_colors(args.sat[0], cl)
        sample.create_sample(cl, files.get_sample_path(args.sat[0]))
        exit(0)

    if args.brt:
        cl = color.get_color_list(args.brt[0])
        val = float(args.brt[1])
        cl = [util.alter_brightness(x, val, 0) for x in cl]

        color.write_colors(args.brt[0], cl)
        sample.create_sample(cl, files.get_sample_path(args.brt[0]))
        exit(0)

    if args.theme and args.theme != "list":
        light = settings['light_theme'] == "true"
        themer.set_pywal_theme(args.theme, light)
        exit(0)

    if args.backend == "list":
        print("\n".join(pywal.colors.list_backends()))
        exit(0)

    if args.update:
        for arg in args.update:
            if arg.endswith(".base"):
                files.update_template(arg)
github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
if args.a:
        add_action = files.add_template if args.t \
                     else themer.create_theme
        for x in args.a:
            if path.isfile(glob.glob(x)[0]):
                add_action(glob.glob(x)[0])
        exit(0)

    if args.c:
        print(themer.get_current())
        exit(0)

    if args.z or args.A:
        alter_action = color.shuffle_colors if args.z \
                       else color.auto_adjust
        arg_list = args.z if args.z else args.A

        for arg in arg_list:
            colors = color.get_color_list(arg)
            colors = alter_action(colors)
            color.write_colors(arg, colors)

            sample.create_sample(colors, files.get_sample_path(arg))
            logging.info("shuffled %s" % arg)
        exit(0)

    if args.link:
        files.add_template(args.link[1], args.link[0])
        exit(0)

    if args.i:
github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
exit(0)

    if args.a:
        add_action = files.add_template if args.t \
                     else themer.create_theme
        for x in args.a:
            if path.isfile(glob.glob(x)[0]):
                add_action(glob.glob(x)[0])
        exit(0)

    if args.c:
        print(themer.get_current())
        exit(0)

    if args.z or args.A:
        alter_action = color.shuffle_colors if args.z \
                       else color.auto_adjust
        arg_list = args.z if args.z else args.A

        for arg in arg_list:
            colors = color.get_color_list(arg)
            colors = alter_action(colors)
            color.write_colors(arg, colors)

            sample.create_sample(colors, files.get_sample_path(arg))
            logging.info("shuffled %s" % arg)
        exit(0)

    if args.link:
        files.add_template(args.link[1], args.link[0])
        exit(0)
github deviantfero / wpgtk / wpgtk / gui / color_grid.py View on Github external
def render_theme(self):
        sample_path = files.get_sample_path(self.selected_file)

        try:
            self.color_list = color.get_color_list(self.selected_file)
        except SystemExit:
            self.color_list = themer.set_fallback_theme(self.selected_file)
        self.render_buttons()

        try:
            self.pixbuf_sample = GdkPixbuf.Pixbuf\
                .new_from_file_at_size(sample_path, width=500, height=300)
        except:
            sample.create_sample(self.color_list, sample_path)
            self.pixbuf_sample = GdkPixbuf.Pixbuf\
                .new_from_file_at_size(sample_path, width=500, height=300)

        self.sample.set_from_pixbuf(self.pixbuf_sample)
        self.parent.sample.set_from_pixbuf(self.pixbuf_sample)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def create_theme(filepath):
    """create a colors-scheme from a filepath"""
    filepath = realpath(filepath)
    filename = basename(filepath).replace(" ", "_")
    tmplink = path.join(WALL_DIR, ".tmp.link")

    symlink(filepath, tmplink)
    shutil.move(tmplink, path.join(WALL_DIR, filename))

    try:
        return color.get_color_list(filename)
    except SystemExit:
        return set_fallback_theme(filename)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def set_fallback_theme(wallpaper):
    """fallback theme for when color generation fails"""
    theme = pywal.theme.file("random")

    color_list = list(theme["colors"].values())
    color.write_colors(wallpaper, color_list)
    sample.create_sample(color_list, files.get_sample_path(wallpaper))

    return color_list
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def set_theme(wallpaper, colorscheme, restore=False):
    """apply a given wallpaper and a given colorscheme"""
    use_vte = settings.getboolean("vte", False)
    is_file = path.isdir(colorscheme) or path.isfile(colorscheme)
    target = colorscheme if is_file else path.join(WALL_DIR, colorscheme)

    set_wall = settings.getboolean("set_wallpaper", True)
    reload_all = settings.getboolean("reload", True)
    colors = color.get_pywal_dict(target, is_file)
    pywal.sequences.send(colors, WPG_DIR, vte_fix=use_vte)

    if not restore:
        pywal.export.every(colors, FORMAT_DIR)
        color.apply_colorscheme(colors)
        if reload_all:
            reload.all()
    else:
        reload.xrdb()

    if set_wall:
        filepath = path.join(WALL_DIR, wallpaper)
        set_wall = filepath if path.isfile(filepath) else colors["wallpaper"]
        pywal.wallpaper.change(set_wall)

    files.write_script(wallpaper, colorscheme)