Correct way to output styles gathered from theme or plugin settings?

Yes, you would use wp_add_inline_style, as you showed in your question

error code: 523