Config¶
daylio-parser comes with a default config that works for the
default Daylio setup after installing the app. That is, there’s
just 5 moods, called awful, bad, meh, good, rad
.
Each mood has its class:
- class Mood¶
- name: str¶
Name of the mood, must correspond with mood name in the exported CSV.
- level: int¶
Assigned numeral level for the mood (higher = better mood). The allowed levels are 1 to 5.
- color: str¶
Any hex color.
- boundaries: Tuple[float, float]¶
A tuple with lower and upper bound for the mood. Any average mood that falls withing these boundaries will be colored using the
Mood.color
.
The whole mood config for your app will be constructed using the
MoodConfig
class.
- class MoodConfig(mood_list=None, color_palette=None)¶
Creates a config with mood_list. If the mood list isn’t provided,
DEFAULT_MOODS
will be used. All moods are automatically colored usingcolor_palette
and boundaries are also calculated. Each boundary is exactly 1 in size, with the first one and the last one being only 0.5 in size.- Parameters
mood_list (List[Tuple[int, str]]) – A list of moods with (level, name)
color_palette (List[str]) – A list of colors (hex values or common names)
- from_list(mood_list, color_palette=None) None ¶
Updates the config with a new list of moods.
- Parameters
mood_list (List[Tuple[str, str]]) – A list of moods with (level, name)
color_palette (List[str]) – A list of colors (hex values or common names)
- static from_file(path) MoodConfig ¶
Loads the MoodConfig from a JSON file. The file structure is:
{ "moods": [(level, name), ...], "colors": [value, ...], }
- get(mood_name) Mood ¶
Returns a
Mood
by its name.Raises
MoodNotFound
if themood_name
doesn’t exist.- Parameters
mood_name (str) – Mood name