diff --git a/src/ls.c b/src/ls.c
index 1b0c250..190cf9f 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4203,7 +4203,11 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target)
type = C_STICKY;
}
else if (S_ISLNK (mode))
- type = C_LINK;
+ type = (change((!linkok
+ && (color_symlink_as_referent
+ || color_indicator[C_ORPHAN].string)), 0)
+ ? C_ORPHAN : C_LINK);
+
else if (S_ISFIFO (mode))
type = C_FIFO;
else if (S_ISSOCK (mode))
@@ -4239,7 +4243,7 @@ print_color_indicator (const struct fileinfo *f, bool symlink_target)
}
/* Adjust the color for orphaned symlinks. */
- if (type == C_LINK && !linkok)
+ if (change(0, type == C_LINK && !linkok))
{
if (color_symlink_as_referent
|| color_indicator[C_ORPHAN].string)