From e519851bf6efde1b1709610e87dc16d98a868c0c Mon Sep 17 00:00:00 2001
From: Mattias Andrée <m@maandree.se>
Date: Sat, 8 Mar 2025 16:08:53 +0100
Subject: style
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <m@maandree.se>
---
 src/redshift.c | 70 +++++++++++++++++++++++++++++-----------------------------
 1 file changed, 35 insertions(+), 35 deletions(-)

(limited to 'src/redshift.c')

diff --git a/src/redshift.c b/src/redshift.c
index 295b1d4..d8969af 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -194,10 +194,10 @@ print_location(const struct location *location)
 	       fabs(location->longitude), location->longitude >= 0.0 ? east : west);
 }
 
-/* Interpolate color setting structs given alpha. */
+/* Interpolate colour setting structs given alpha. */
 static void
-interpolate_color_settings(const struct color_setting *first, const struct color_setting *second,
-                           double alpha, struct color_setting *result)
+interpolate_colour_settings(const struct colour_setting *first, const struct colour_setting *second,
+                            double alpha, struct colour_setting *result)
 {
 	int i;
 	alpha = CLAMP(0.0, alpha, 1.0);
@@ -207,17 +207,17 @@ interpolate_color_settings(const struct color_setting *first, const struct color
 		result->gamma[i] = (1.0 - alpha) * first->gamma[i] + alpha * second->gamma[i];
 }
 
-/* Interpolate color setting structs transition scheme. */
+/* Interpolate colour setting structs transition scheme. */
 static void
-interpolate_transition_scheme(const struct transition_scheme *transition, double alpha, struct color_setting *result)
+interpolate_transition_scheme(const struct transition_scheme *transition, double alpha, struct colour_setting *result)
 {
-	interpolate_color_settings(&transition->night, &transition->day, alpha, result);
+	interpolate_colour_settings(&transition->night, &transition->day, alpha, result);
 }
 
-/* Return 1 if color settings have major differences, otherwise 0.
+/* Return 1 if colour settings have major differences, otherwise 0.
    Used to determine if a fade should be applied in continual mode. */
 static int
-color_setting_diff_is_major(const struct color_setting *first, const struct color_setting *second)
+colour_setting_diff_is_major(const struct colour_setting *first, const struct colour_setting *second)
 {
 	return MAX(first->temperature, second->temperature) - MIN(first->temperature, second->temperature) > 25UL ||
 	       fabs(first->brightness - second->brightness) > 0.1 ||
@@ -452,7 +452,7 @@ ease_fade(double t)
 /* Run continual mode loop
    This is the main loop of the continual mode which keeps track of the
    current time and continuously updates the screen to the appropriate
-   color temperature. */
+   colour temperature. */
 static void
 run_continual_mode(const struct location_provider *provider, LOCATION_STATE *location_state,
                    const struct transition_scheme *scheme, const struct gamma_method *method,
@@ -462,9 +462,9 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 	int prev_disabled = 1;
 	int disabled = 0;
 	int location_available = 1;
-	struct color_setting fade_start_interp;
-	struct color_setting prev_target_interp;
-	struct color_setting interp;
+	struct colour_setting fade_start_interp;
+	struct colour_setting prev_target_interp;
+	struct colour_setting interp;
 	struct location loc;
 	int need_location;
 
@@ -478,11 +478,11 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 
 	signals_install_handlers();
 
-	/* Previous target color setting and current actual color setting.
-	   Actual color setting takes into account the current color fade. */
-	prev_target_interp = COLOR_SETTING_NEUTRAL;
+	/* Previous target colour setting and current actual colour setting.
+	   Actual colour setting takes into account the current colour fade. */
+	prev_target_interp = COLOUR_SETTING_NEUTRAL;
 
-	interp = COLOR_SETTING_NEUTRAL;
+	interp = COLOUR_SETTING_NEUTRAL;
 
 	loc = (struct location){NAN, NAN};
 	need_location = !scheme->use_time;
@@ -504,12 +504,12 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 		printf(_("Brightness: %.2f\n"), interp.brightness);
 	}
 
-	/* Continuously adjust color temperature */
+	/* Continuously adjust colour temperature */
 	for (;;) {
 		double now;
 		enum period period;
 		double transition_prog;
-		struct color_setting target_interp;
+		struct colour_setting target_interp;
 		int delay, loc_fd;
 
 		/* Check to see if disable signal was caught */
@@ -551,12 +551,12 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 			transition_prog = get_transition_progress_from_elevation(scheme, elevation);
 		}
 
-		/* Use transition progress to get target color temperature. */
+		/* Use transition progress to get target colour temperature. */
 		interpolate_transition_scheme(scheme, transition_prog, &target_interp);
 
 		if (disabled) {
 			period = PERIOD_NONE;
-			target_interp = COLOR_SETTING_NEUTRAL;
+			target_interp = COLOUR_SETTING_NEUTRAL;
 		}
 
 		if (done)
@@ -576,8 +576,8 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 		/* Start fade if the parameter differences are too big to apply
 		   instantly. */
 		if (use_fade) {
-			if (fade_length ? color_setting_diff_is_major(&target_interp, &prev_target_interp)
-			                : color_setting_diff_is_major(&interp, &target_interp)) {
+			if (fade_length ? colour_setting_diff_is_major(&target_interp, &prev_target_interp)
+			                : colour_setting_diff_is_major(&interp, &target_interp)) {
 				fade_length = FADE_LENGTH;
 				fade_time = 0;
 				fade_start_interp = interp;
@@ -589,7 +589,7 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 			double frac = ++fade_time / (double)fade_length;
 			double alpha = CLAMP(0.0, ease_fade(frac), 1.0);
 
-			interpolate_color_settings(&fade_start_interp, &target_interp, alpha, &interp);
+			interpolate_colour_settings(&fade_start_interp, &target_interp, alpha, &interp);
 
 			if (fade_time > fade_length) {
 				fade_time = 0;
@@ -614,7 +614,7 @@ run_continual_mode(const struct location_provider *provider, LOCATION_STATE *loc
 		if (method->set_temperature(method_state, &interp, preserve_gamma) < 0)
 			eprintf(_("Temperature adjustment failed."));
 
-		/* Save period and target color setting as previous */
+		/* Save period and target colour setting as previous */
 		prev_period = period;
 		prev_target_interp = target_interp;
 
@@ -687,7 +687,7 @@ main(int argc, char *argv[])
 	struct location loc = { NAN, NAN };
 	double now, transition_prog;
 	enum period period;
-	struct color_setting color;
+	struct colour_setting colour;
 
 	argv0 = argv[0];
 
@@ -776,14 +776,14 @@ main(int argc, char *argv[])
 			       options.scheme.day.temperature, options.scheme.night.temperature);
 		}
 
-		/* Color temperature */
+		/* Colour temperature */
 		if (!WITHIN(MIN_TEMPERATURE, options.scheme.day.temperature, MAX_TEMPERATURE) ||
 		    !WITHIN(MIN_TEMPERATURE, options.scheme.night.temperature, MAX_TEMPERATURE))
 			eprintf(_("Temperature must be between %luK and %luK."), MIN_TEMPERATURE, MAX_TEMPERATURE);
 	}
 
 	if (options.mode == PROGRAM_MODE_MANUAL) {
-		/* Check color temperature to be set */
+		/* Check colour temperature to be set */
 		if (!WITHIN(MIN_TEMPERATURE, options.temp_set, MAX_TEMPERATURE))
 			eprintf(_("Temperature must be between %luK and %luK."), MIN_TEMPERATURE, MAX_TEMPERATURE);
 	}
@@ -887,20 +887,20 @@ main(int argc, char *argv[])
 			transition_prog = get_transition_progress_from_elevation(scheme, elevation);
 		}
 
-		/* Use transition progress to set color temperature */
-		interpolate_transition_scheme(scheme, transition_prog, &color);
+		/* Use transition progress to set colour temperature */
+		interpolate_transition_scheme(scheme, transition_prog, &colour);
 
 		if (options.verbose || options.mode == PROGRAM_MODE_PRINT) {
 			print_period(period, transition_prog);
-			printf(_("Color temperature: %luK\n"), color.temperature);
-			printf(_("Brightness: %.2f\n"), color.brightness);
+			printf(_("Color temperature: %luK\n"), colour.temperature);
+			printf(_("Brightness: %.2f\n"), colour.brightness);
 		}
 
 		if (options.mode == PROGRAM_MODE_PRINT)
 			break;
 
 	apply:
-		if (options.method->set_temperature(method_state, &color, options.preserve_gamma) < 0)
+		if (options.method->set_temperature(method_state, &colour, options.preserve_gamma) < 0)
 			eprintf(_("Temperature adjustment failed."));
 
 #ifndef WINDOWS
@@ -917,12 +917,12 @@ main(int argc, char *argv[])
 	case PROGRAM_MODE_MANUAL:
 		if (options.verbose)
 			printf(_("Color temperature: %luK\n"), options.temp_set);
-		color = scheme->day;
-		color.temperature = options.temp_set;
+		colour = scheme->day;
+		colour.temperature = options.temp_set;
 		goto apply;
 
 	case PROGRAM_MODE_RESET:
-		color = COLOR_SETTING_NEUTRAL;
+		colour = COLOUR_SETTING_NEUTRAL;
 		options.preserve_gamma = 0;
 		goto apply;
 
-- 
cgit v1.2.3-70-g09d2