summaryrefslogtreecommitdiff
path: root/config/vim/plugin/pickachu/processors.py
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-12-05 22:02:25 +0000
committerdavidovski <david@davidovski.xyz>2021-12-05 22:02:25 +0000
commit74452dfb1735e7347459f3b024770ce285f7c96d (patch)
tree7c3a812c3d6e7c135b5924e2d353e6daac2353fd /config/vim/plugin/pickachu/processors.py
parentbcdb3419af4a28135e2e668cd61b49db72e95796 (diff)
removed shaders
Diffstat (limited to 'config/vim/plugin/pickachu/processors.py')
-rw-r--r--config/vim/plugin/pickachu/processors.py80
1 files changed, 0 insertions, 80 deletions
diff --git a/config/vim/plugin/pickachu/processors.py b/config/vim/plugin/pickachu/processors.py
deleted file mode 100644
index 0fe04c1..0000000
--- a/config/vim/plugin/pickachu/processors.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import vim
-from datetime import datetime
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# name: processors.py
-# description: this file contains functions that process data
-# from the runapp function (in app.py).
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-
-DEFAULT_DATE_FORMAT = vim.eval("g:pickachu_default_date_format")
-DEFAULT_COLOR_FORMAT = vim.eval("g:pickachu_default_color_format")
-
-def dateProcessor(input, format=DEFAULT_DATE_FORMAT):
- try:
- dateObj = datetime.strptime(input, '%m/%d/%Y')
- except(ValueError):
- dateObj = datetime.strptime(input, '%m/%d/%y')
- return dateObj.strftime(format)
-
-def colorProcessor(input, format=DEFAULT_COLOR_FORMAT):
- # The system color picker returned an rgba value
- if 'rgba' in input:
- strip = input.strip('rgba)(')
- array = strip.split(',')
- # Round the alpha value to two decimal placed
- array[3] = round(float(array[3]), 2)
- rgba_string = "rgba("
- values = ",".join(str(x) for x in array)
- rgba_string += values + ")"
- return rgba_string
- # The system color picker returned an rgb value
- elif 'rgb' in input:
- # RGB as input
- if format == 'rgb':
- return input
- else:
- # Strip 'rgb' and parenthesis
- strip = input.strip('rgb)(')
- array = strip.split(',')
-
- if format == 'hex':
- hex = '#%02x%02x%02x' % (int(array[0]), int(array[1]), int(array[2]))
- return hex.upper()
- elif format == 'rgba':
- rgba_string = "rgba("
- array.append(1)
- values = ",".join(str(x) for x in array)
- rgba_string += values + ")"
- return rgba_string
- return array
- # The system olor picker returned a hex
- elif '#' in input:
- # If there is a '#' in input,
- # they are most likely using Qarma instead of Zenity
- # or any other program that outputs hex
- if format == 'hex':
- return input
- else:
- hex = input.lstrip('#')
- rgb_array = tuple(int(hex[i:i+2], 16) for i in (0, 2 ,4))
-
- if format == 'rgb':
- rgb_string = "rgb("
- for i in range(0, len(rgb_array)):
- rgb_string += str(rgb_array[i])
- if i < len(rgb_array) - 1:
- rgb_string += ", "
- else:
- rgb_string += ")"
- return rgb_string
- elif format == 'rgba':
- rgba_string = "rgba("
- for i in range(0, len(rgb_array)):
- rgba_string += str(rgb_array[i])
- if i < len(rgb_array) - 1:
- rgba_string += ", "
- else:
- rgba_string += ", 1)"
- return rgba_string
- return None