How can I give a list_string BaseFieldDefinition in a content entity a default starting value? I have an entity with a list_string field in my content entity that outputs to the entity form as a list of checkboxes. IE:

$fields['colors'] = BaseFieldDefinition::create("list_string")
  -&gt;setSettings([
    'allowed_values' =&gt; ['blue' =&gt; 'Blue', 'red' =&gt; 'Red', 'green' =&gt; 'Green']
  ])
  -&gt;setLabel('Color')
  -&gt;setDescription('Select color')
  -&gt;setRequired(TRUE)
  -&gt;setCardinality(-1)
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'options_buttons',
    'weight' =&gt; 2,
  ))
  -&gt;setDisplayConfigurable('form', TRUE);


Is there a way for me to give this field a default starting value. IE, when the user creates a new entity, red and green start out selected on the form?
You can use setDefaultValue method:

BaseFieldDefinition::setDefaultValue([['value' =&gt; 'red'], ['value' =&gt; 'green']])


That will also work for entities not created in the UI.