Hi Jefferson,
You can use std
attribute for a text field, like this:
$post_id = isset( $_GET['post'] ) ? intval( $_GET['post'] ) : ( isset( $_POST['post_ID'] ) : intval( $_POST['post_ID'] ) : false );
$meta_boxes[] = [
'fields' => [
[
'type' => 'text',
'id' => 'color',
'std' => generate_my_own_code( $post_id ),
],
],
];