How to use the wpgtk.data.color.write_colors 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
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:
        themer.import_theme(args.i[0], args.i[1], args.T)
        exit(0)

    if args.o:
        themer.export_theme(*args.o)
        exit(0)
github deviantfero / wpgtk / wpgtk / __main__.py View on Github external
exit(1)
        exit(0)

    if args.theme == "list":
        dark = settings['light_theme'] != "true"
        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)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
def set_pywal_theme(theme_name, light):
    """sets a pywal theme and applies it to wpgtk"""
    current = get_current()
    theme = pywal.theme.file(theme_name, light)

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

    set_theme(current, current)
github deviantfero / wpgtk / wpgtk / data / themer.py View on Github external
"""import a colorscheme from a JSON file either in
    terminal.sexy or pywal format"""
    json_file = realpath(json_file)
    filename = basename(json_file)

    if theme:
        theme = pywal.theme.file(filename)
        color_list = list(theme["colors"].values())
    else:
        try:
            color_list = color.get_color_list(json_file, True)
        except IOError:
            logging.error("file does not exist")
            return

    color.write_colors(wallpaper, color_list)
    sample.create_sample(color_list, files.get_sample_path(wallpaper))
    logging.info("applied %s to %s" % (filename, wallpaper))