colorseq.helperfcts

generate_vals(next_generator, value_range, init_val)[source]

Generator to yield values within a permitted range.

Parameters:
  • next_generator (generator) – must yield a value within [0, 1].
  • value_range (tuple, float) – specify the range within which values will be generated. If a single value is provided then only this value will be returned by the generator.
  • init_val (float) – The first value to return. It must lay within the value_range provided. If value_range is a single value, then this parameter is ignored.
next_gr_value(initial_value)[source]

Generator providing then next value in [0,1].

This approach exploits the fact that successively adding the golden ratio followed by a modulo 1 operation leads to evenly distributed values in the interval [0, 1].

Parameters:val (float) – A value in [0, 1] to which the golden ratio will be added.
set_vals(next_generator, n, param, init_val, shuffler)[source]

Set a defined number of values with the option to shuffle the order.

Parameters:n (int) – number of different colours to generate.