Permalink
Browse files

Improve machine API to the themes

* Improve index/index.json
* Add MD5 sum of that file into index/index.json.md5
* Remove experimental index.conf and index.xml files from the build
* Remove genindex script and related template files
* Add screenshot-missing.png icon to screenshots dir
  - From elementary-xfce icon theme (status/64/image-missing.png)
* Update index/README.md detailing the format/fields of the JSON file.
  • Loading branch information...
codebrainz committed Jun 18, 2013
1 parent 4242e66 commit fdbfeaf20609b045a6387796f6824cc42846da1a
View
@@ -27,18 +27,18 @@ uninstall:
# safety in case there's other stuff in there.
rm -f $(UNINSTALL_THEMES)
-indices:
- make -C scripts indices
+index:
+ make -C index
+
+clean:
+ make -C index clean
colorsnormal:
python scripts/colornorm.py $(THEMES)
usedefaults:
python scripts/defaultify.py $(THEMES)
-clean:
- make -C scripts clean
-
ChangeLog:
git --no-pager log --format="%ai %aN %n%n%x09* %s%n" > ChangeLog
View
@@ -0,0 +1,15 @@
+scheme_files = $(wildcard ../colorschemes/*.conf)
+screen_files = $(wildcard ../screenshots/*.png)
+
+all: index.json index.json.md5
+
+index.json: $(scheme_files) $(screen_files)
+ python ../scripts/mkindex.py > $@
+
+index.json.md5: index.json
+ md5sum $< > $@
+
+clean:
+ rm -f index.json*
+
+.PHONY: all clean
View
@@ -1,39 +1,80 @@
-Geany Themes Index Files README
-===============================
+Geany Themes Index File README
+==============================
-The files here are auto-generated using the `indices` rule to the main
-`Makefile`. Like `make indices` should result in these index files being
-regenerated (if needed).
+The `index.json` file is auto-generated using the `make index` command.
+The `index` rule of the Makefile runs the `scripts/mkindex.py` script
+which reads the colour schemes' info, generates screenshot and download
+URLs, base64 encoded 64x64 thumbnails and stores it all into a JSON
+formatted text file.
-Whenever a color scheme changes it's supposed to increment its `version`
-key in the `theme_info` group. This changing version number, output into
-the destination index files, will allow clients to detect newer versions
-of the color schemes.
+File Format
+-----------
-There are 3 output formats: [GKeyFile][gkf], [XML][xml] and [JSON][json].
-Looking at the generated files should make it obvious how to parse them. The
-canonical source if these files is:
+The JSON file consists of a top-level dictionary where the keys are
+the theme "identifiers" (ie. name used in filenames and code). The
+identifiers are not necessarily useful to humans.
-* [index.conf][gkfidx]
-* [index.xml][xmlidx]
-* [index.json][jsonidx]
+### Theme Info Fields
-Barring some Github outtage or them banning these links, they point to where
-clients can find the index files.
+#### author
-If you have updated one or more color scheme `.conf` files, change into the
-root Geany-Themes directory and run:
+The author field contains a name and usually an email address, although
+the value may be an empty string as well (ie. unknown author). This
+string is meant to be human-readable.
- $ make indices
+#### colorscheme
-The generated index files are checked into the Geany-Themes Git repository
-so there will be a bit of noise whenever updating color scheme files. It
-might be beneficial to make one commit for the real changes and one for
-updating the generated files.
+This is the download URL of the color scheme `.conf` file. If the file
+this URL points to is downloaded into the user's colour scheme directory,
+the colour scheme will be available in Geany for user once it's restarted.
+This field will never be empty.
-[gkf]: http://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html
-[xml]: http://www.w3.org/XML
-[json]: http://www.json.org
-[gkfidx]: https://raw.github.com/codebrainz/geany-themes/master/index/index.conf
-[xmlidx]: https://raw.github.com/codebrainz/geany-themes/master/index/index.xml
-[jsonidx]: https://raw.github.com/codebrainz/geany-themes/master/index/index.json
+#### description
+
+A short description of the theme or an empty string. The string is meant
+to be displayed to human beings.
+
+#### md5hash
+
+An MD5 hash of the colour scheme `.conf` file from the last time it was
+changed. This value can be used to check if a local scheme needs updating
+and/or to verify the integrity of the file that could be downloaded using
+the `colorscheme` URL field. This field will never be empty.
+
+#### name
+
+A human-readable name of the colour scheme meant to be display for example
+in a GUI label/widget. This field will never be empty.
+
+#### screenshot
+
+This is the download URL for a preview image of the colour scheme. The
+image will always be in PNG format and the resolution, although not
+guaranteed, will be large enough to give an idea of what the colour
+scheme looks like. This may be an empty string if the color scheme
+doesn't have a screenshot or it may be a generic "screenshot missing"
+image.
+
+#### thumbnail
+
+This is a thumbnail image, 64 pixels wide and 64 pixels high, in PNG
+format, base64 encoded (for storing in text file). This is a small icon
+of the preview screenshot suitable for displaying for example in a GUI
+list of schemes. This maybe be an empty string if the colour scheme
+doesn't have a screenshot or it maybe be a generic "screenshit missing"
+icon that is 64 pixels wide and tall.
+
+#### version
+
+This field contains a whole number that is incremented each time the
+theme is changed. You can compare this against installed color scheme
+versions to see if an update is available.
+
+<s>The version number is a sequence of one or more digits, optionally
+separated by periods/decimal points. The string will always contain
+only 0-9 and optional decimal points in between any of the numbers,
+for example "1.2.3", "123", "12.3", but never "..2", ".2.", "....", etc.
+The result of splitting the string on the decimal point and converting
+each component into an integer will always succeed and the string will
+never be empty. One or more of the numbers in the string will move in
+the upward direction when the colour scheme is modified.</s>
View
@@ -1,157 +0,0 @@
-# This file is auto-generated from `index.conf.in`, do not edit!
-#
-# The special repositories group, for color schemes `repo_name` for
-# screenshots `repo_name_screens`. Both point to a URI that when having the
-# color schemes name and extension will resolve to a file. The basename is
-# each color scheme's group name here, ex. [bespin] is bespin.conf and
-# bespin.png for color schemes and screenshots, respectively.
-[repositories]
-default=https://raw.github.com/codebrainz/geany-themes/master/colorschemes
-default_screens=https://github.com/codebrainz/geany-themes/raw/master/screenshots
-
-# Each theme follows the pattern:
-# [theme_name]
-# name=The Theme Name
-# desc=The description of the theme.
-# repos=repo_name
-# vers=42
-[bespin]
-name=Bespin
-desc=A port of the Bespin theme.
-repos=default
-version=1.22.0
-
-[black]
-name=Black Scheme
-desc=Black background, other colours
-repos=default
-version=1.22.0
-
-[dark-fruit-salad]
-name=Dark Fruit Salad
-desc=Low contrast theme ported from the set_geany_colors utility
-repos=default
-version=1.22.0
-
-[dark]
-name=Dark
-desc=Dark syntax colouring theme
-repos=default
-version=1.22.0
-
-[fluffy]
-name=Fluffy
-desc=A soft and downy color scheme.
-repos=default
-version=1.22.0
-
-[gedit]
-name=Gedit
-desc=A port of Gedit's default theme.
-repos=default
-version=1.22.0
-
-[github]
-name=GitHub
-desc=Similar to GitHub.com's highlighting colors.
-repos=default
-version=1.22.0
-
-[inkpot]
-name=InkPot
-desc=Based on the vim theme of the same name.
-repos=default
-version=1.22.0
-
-[kugel]
-name=Kugel
-desc=A dark, but not too dark with focus to be comfortable to the eyes.
-repos=default
-version=1.22.0
-
-[mc]
-name=Ralesk's MC
-desc=Midnight Commander-like scheme
-repos=default
-version=1.22.1
-
-[monokai]
-name=Monokai
-desc=It's warm, colorful and pleasing to the eyes
-repos=default
-version=1.0
-
-[oblivion2]
-name=Oblivion 2
-desc=Based on the Gedit color scheme Oblivion and the Dark Color Scheme with rearranged colors.
-repos=default
-version=1.22.0
-
-[pygments]
-name=Pygments
-desc=Default Pygments theme for Geany
-repos=default
-version=1.22.0
-
-[railcasts2]
-name=Railcasts 2
-desc=A port of railscasts2 from gedit-themes.
-repos=default
-version=1.22.0
-
-[retro]
-name=Retro
-desc=Inspired by old green screen terminals.
-repos=default
-version=0.01
-
-[slushpoppies]
-name=Slush and Poppies
-desc=A port of Slush and Poppies from gedit-themes.
-repos=default
-version=1.22.0
-
-[solarized-dark]
-name=Solarized (dark)
-desc=Dark Solarized theme for Geany
-repos=default
-version=1.22.0
-
-[solarized-light]
-name=Solarized (light)
-desc=Light Solarized theme for Geany
-repos=default
-version=1.22.0
-
-[tango-dark]
-name=Tango
-desc=Loosely based on the Dark theme, but Tangofied.
-repos=default
-version=1.22.0
-
-[tango-light]
-name=Tango Light
-desc=A light theme using Tango colors.
-repos=default
-version=1.22.0
-
-[tinge]
-name=Tinge
-desc=A tinge more tanginess
-repos=default
-version=1.22.0
-
-[vibrant-ink]
-name=Vibrant
-desc=Vibrant Ink Theme for Geany
-repos=default
-version=1.22.0
-
-[zenburn]
-name=Zenburn
-desc=A port of Zenburn from gedit-themes.
-repos=default
-version=1.22.0
-
-
-
Oops, something went wrong.

0 comments on commit fdbfeaf

Please sign in to comment.