Skip to content

Change contract text color for disconnected contracts and connections#60

Merged
eggrobin merged 2 commits intomockingbirdnest:masterfrom
periodically-makes-puns:master
Feb 9, 2026
Merged

Change contract text color for disconnected contracts and connections#60
eggrobin merged 2 commits intomockingbirdnest:masterfrom
periodically-makes-puns:master

Conversation

@periodically-makes-puns
Copy link
Contributor

If any connection in a contract is disconnected, changes the text colour for that contract to orange. Likewise, for connections in a contract, when expanded the text colour of disconnected connections will be orange (similar to #33, though this changes the entire line rather than just the status).

This allows checking the status of all contracts at a glance in the Skopos window, to ensure that taking a new contract didn't break maintenance for a different contract without having to open and check all connections over all contracts.

Does not attempt to resolve #6. Also, the current implementation can result in rapidly flashing text if the availability for a connection changes rapidly (e.g. during timewarp). Performance impact appears to be minimal, as far as I can tell.

I am not particularly attached to the colour, I just want disconnected contracts to be visually distinguishable at a glance.

Example image:
image

Comment on lines +69 to +70
var disconnected_style = principia.ksp_plugin_adapter.Style.Warning(
UnityEngine.GUI.skin.label);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awkward line-break: make single-line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, also changed it to be based off of ok_style so there's no awkward duplication of UnityEngine.GUI.skin.label.

Comment on lines +75 to +81
bool all_available = connections.All(connection => {
if (connection is PointToMultipointConnection point_to_multipoint) {
return point_to_multipoint.channel_services.All(service => service.basic.available);
} else if (connection is DuplexConnection duplex) {
return duplex.basic_service.available;
} else { return false; }
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm not a huge fan of this single-use in-line method definition, I suppose it works here. And is easily lift-able to another scope if this is needed in more places.

bool available = services.basic.available;
var style = available ? ok_style : disconnected_style;
string status = available ? "OK" : "Disconnected";
var style = available ? ok_style : disconnected_style;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate of line R120, delete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed line 120 to keep line 122. Trying to keep the ordering consistent across dupes

Copy link
Contributor

@DRVeyl DRVeyl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eggrobin eggrobin merged commit 95738ec into mockingbirdnest:master Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long connection names don't fit in connection window

3 participants